Re: Compatibility of Data iPhone / Mac
Re: Compatibility of Data iPhone / Mac
- Subject: Re: Compatibility of Data iPhone / Mac
- From: Kyle Sluder <email@hidden>
- Date: Fri, 21 May 2010 16:41:01 -0700
On Fri, May 21, 2010 at 4:35 PM, Eiko Bleicher <email@hidden> wrote:
> When transferring data between Mac and iPhone/iPad, serializing via NSKeysedArchiver seems simple and easy. Wrapping up some "trivial" Objects like NSData, NSDictionary, NSNumber, NSString seems to work.
>
> But the question is: is it considered safe to transfer data like that? How likely is this scenario going to fail? I imagine how a simple binary change makes everything crash; but given that there might be tons of Applications that store data in a similar fashion, this probably is just not going to happen.
This isn't really a safe thing to do. If you want to archive simple
stuff like strings, arrays, and dictionaries, use
NSPropertyListSerialization. Otherwise, write a custom serialization
scheme. Archiving (keyed or not) is very fragile, if for no other
reason than it relies on the existence of classes at unarchive time
that existed at archive time.
> So I would need to worry about changes on one platform that generates compatibilty problems on the other. Have there ever been issues with that?
Not to my knowledge, but I don't see any versioning mechanism so it's
quite possible there might be in the future.
> It wouldn't be a big deal if I needed to package my data on my own, but this also opens room for bugs....
Better to do the right thing in this case.
--Kyle Sluder
_______________________________________________
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