• 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: Override load/save for NSDictionary ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Override load/save for NSDictionary ? (From: Mark Thomas <email@hidden>)
 >Re: Override load/save for NSDictionary ? (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Asynchronous timers (without a run loop)
  • Next by Date: Re: Bindings for Custom Cell in NSOutlineView ( using NSTreeController )
  • Previous by thread: Re: Override load/save for NSDictionary ?
  • Next by thread: Re: Override load/save for NSDictionary ?
  • Index(es):
    • Date
    • Thread