Re: Serializing NSDictionary for network transfer
Re: Serializing NSDictionary for network transfer
- Subject: Re: Serializing NSDictionary for network transfer
- From: Carl Hoefs <email@hidden>
- Date: Wed, 07 May 2014 12:30:29 -0700
On May 7, 2014, at 12:06 PM, Alex Zavatone <email@hidden> wrote:
> If your dictionary has only text values, this should be no problem with the NSJSONSerialization, but if you're sending images, you'll need to convert the images to 16 bit encoded NSData objects.
>
> I guess the bigger question is, "what are the data types within your dictionary"?
>
> If it's just text, then you should have good luck with NSJSONSerialization.
>
> Another question is, "where are you sending that data to?" What type of service will receive it?
>
For the moment, I'm using only NSStrings and NSNumbers. I'm sending data back and forth between OSX and iOS devices, and NSDictionary is a very convenient container. Once I show that this will work then the pressure will ease off and I'll have time dig into more generalized ways (NSPropertyListSerialization?), ensuring things won't break in the future when requirements and use cases change. I just wasn't prepared going into this for the steep learning curve for what I assumed was a more or less trivial data serialization function. The documentation (which, yes, I have read but still can't make much sense of) documents but doesn't educate very well. I'm still a bit overwhelmed by the sometimes huge generalized mechanisms required to do things the Cocoa way, but I will overcome that with time and effort.
-Carl
_______________________________________________
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