|Dec 18, 2011, 04:09 PM||#1|
Encoding vs Array and Dictionary
I'm currently being introduced slowly to encoding in Objective C, and I have a fundamental question to ask.
Why would an Object orientated programmer want to encode an object to the file system, instead of create an array or dictionary of objects?
I know there's a sensible answer to this, so please don't think I'm contesting the logic of it.
|Dec 18, 2011, 06:51 PM||#4|
|Dec 19, 2011, 12:55 AM||#5|
If the complementary -decodeWithCoder: methods are written correctly, NSKeyedUnarchiver can restore the entire object graph using the data object that was archived. This technique allows a much richer and more complex structure to be saved and restored easily and efficiently than you might be able to do with an array or dictionary. Once decoded, you program state is essentially fully restored to what it was when you saved it (except, usually, without the undo stack).
If you look at the documentation for NSArray or NSDictionary, you will see that there are strict limitations on what they can write to a file; encoding lets you get around these limitations.
You got to be a spirit. You can't be no ghost.
|array, dictionary, encoding, objective|
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Custom Dictionary in the native OS X Dictionary App||gtx383||Mac Programming||1||Apr 10, 2013 05:42 PM|
|Array Containing Dictionaries||ahan.tm||iPhone/iPad Programming||2||Nov 18, 2012 11:31 AM|
|NSMutable Array Help||AnonymousInUse||iPhone/iPad Programming||12||Oct 11, 2012 04:46 PM|
|RAID Array help||Lord Adama||Mac Pro||3||Jun 5, 2012 11:27 PM|
All times are GMT -5. The time now is 10:39 PM.