On May 7, 2014, at 11:17 , Carl Hoefs <[email protected]> wrote:
> (1) I see that NSDictionary has an encoding method:
>
> - (void)encodeWithCoder:(NSCoder *)coder;
>
> but this returns (void), which is puzzling to me. I would expect it to return
> (void *) to a malloced region containing the serialization. Where does the
> object serialization reside, and how do I access it?
NSKeyedArchiver and NSKeyedUnarchiver are the classes that perform the encoding
and decoding. They are responsible for invoking ‘encodeWithCoder:’ and
‘initWithCoder:’ for the objects that make up an archive — you don’t do that
yourself.
Both NSKeyedArchiver and NSKeyedUnarchiver have convenience class methods for
archiving and unarchiving an object hierarchy to/from NSData. (You can also
create instances of NSKeyedArchiver and NSKeyedUnarchiver if you need a finer
level of control.)
Class NSPropertyListSerialization provides a similar service, but for a more
restricted kind of object graph, useful when you want a textual representation
of the data, for example.
You really should read some of the documentation:
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Archiving/Archiving.html
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/PropertyLists/Introduction/Introduction.html
Just reading the introductory sections should orient you in this Cocoa sub
universe.
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]