Re: Override load/save for NSDictionary ?
Re: Override load/save for NSDictionary ?
- Subject: Re: Override load/save for NSDictionary ?
- From: "Michael Ash" <email@hidden>
- Date: Fri, 5 Dec 2008 10:52:41 -0500
On Fri, Dec 5, 2008 at 6:58 AM, Graham Cox <email@hidden> wrote:
> I'd love to know what you think is wrong with the file format that keyed
> archiving creates that your own would improve on....?
I can only speak for myself, of course, but there are at least two
major problems with it:
1) It is proprietary, albeit reverse-engineerable, making it difficult
to access your data without Mac OS X.
2) It doesn't correctly escape strings, producing all sorts of fun
results if you encode the string "$null":
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
@"$null", @"key", nil];
NSData *data = [NSKeyedArchiver archivedDataWithRootObject: dict];
NSDictionary *dict2 = [NSKeyedUnarchiver unarchiveObjectWithData: data];
$ ./a.out
2008-12-05 10:52:15.637 a.out[1061:10b] *** Terminating app due to
uncaught exception 'NSInvalidArgumentException', reason: '***
-[__NSPlaceholderDictionary initWithObjects:forKeys:]: number of
objects (0) not equal to number of keys (1)'
Mike
_______________________________________________
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