|Dec 18, 2011, 03: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, 05:51 PM||#4|
|Dec 18, 2011, 11:55 PM||#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|
|Objective C Help - Encoding||nashyo||Mac Programming||25||Dec 21, 2011 10:51 AM|
|Array and Dictionary||naphatkrit||iPhone/iPad Programming||2||Aug 7, 2011 09:49 PM|
|How to integrate a SearchBar from an Array of Dictionaries||Nekbeth||iPhone/iPad Programming||1||Mar 28, 2011 01:25 PM|
|An Array Of Dictionaries Not Writing To File Correctly?||Darkroom||iPhone/iPad Programming||6||Aug 29, 2009 10:22 AM|
|Filtering an array with dictionary objects||Farani||iPhone/iPad Programming||0||Nov 8, 2008 01:59 PM|
All times are GMT -5. The time now is 07:29 PM.