• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Serializing NSDictionary for network transfer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Serializing NSDictionary for network transfer


  • Subject: Re: Serializing NSDictionary for network transfer
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 07 May 2014 11:35:16 -0700

On May 7, 2014, at 11:17 , Carl Hoefs <email@hidden> 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@hidden)

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:

This email sent to email@hidden


References: 
 >Serializing NSDictionary for network transfer (From: Carl Hoefs <email@hidden>)

  • Prev by Date: Re: Serializing NSDictionary for network transfer
  • Next by Date: Re: Serializing NSDictionary for network transfer
  • Previous by thread: Re: Serializing NSDictionary for network transfer
  • Next by thread: Re: Serializing NSDictionary for network transfer
  • Index(es):
    • Date
    • Thread