Re: Serializing NSDictionary for network transfer
Re: Serializing NSDictionary for network transfer
- Subject: Re: Serializing NSDictionary for network transfer
- From: SevenBits <email@hidden>
- Date: Wed, 07 May 2014 15:07:20 -0400
On Wednesday, May 7, 2014, Carl Hoefs <email@hidden>
wrote:
>
> On May 7, 2014, at 11:38 AM, Wim Lewis <email@hidden <javascript:;>>
> wrote:
>
> > Depending on what is *in* your NSDictionary, though, a less opaque
> serialization format might be better, such as one of the property-list
> formats (see NSPropertyListSerialization) or even JSON. These formats can
> only hold a small, non-extensible set of types, and can't encode recursive
> structures or preserve the sharedness of parts of the object graph, but
> have the significant advantage that they are easier to inspect and are
> easier to keep decoupled from implementation details of your app.
>
> I realize I have a ways to go before I grok Cocoa, as I still approach
> things from the minimalist Linux perspective. It's a simple NSDictionary
> with a few strings and numbers in it, so maybe (for the moment) the JSON
> approach might get me going, then I can revisit the issue with a more
> general Cocoa solution.
That will work only as long the types in the NSDictionary are textual types
representable in JSON, as previously stated. If even one element is not,
the archiving will fail. I prefer to archive to binary data because usually
the user never has to read the serialized data in its raw form, plus it
avoids the disadvantages of non-extensibility and no recursion.
>
> Thanks!
> -Carl
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden <javascript:;>)
>
> 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 <javascript:;>
_______________________________________________
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