• 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: NSKeyedArchiever and XML Format
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSKeyedArchiever and XML Format


  • Subject: Re: NSKeyedArchiever and XML Format
  • From: Nathan Vander Wilt <email@hidden>
  • Date: Thu, 11 Dec 2008 18:05:59 -0800


On Dec 11, 2008, at 5:34 PM, Martin Wierschin wrote:

[a encodeObject:p forKey:@"root"];

Does using: [a encodeRootObject:p];

instead of the line above make it work as expected?

A good idea, but IIRC that did not work. In fact, I think it produced an archive that silently failed to be read back by the stock +[NSKeyedUnarchiver unarchiveObjectWithFile:] convenience method.


While the documentation for that method itself makes no mention of that fact, the documentation at http://developer.apple.com/documentation/Cocoa/Conceptual/Archiving/Tasks/decoding.htm does say "NSKeyedUnarchiver requires that the object graph in the archive was encoded with one of NSKeyedArchiver’s convenience class methods, such as archiveRootObject:toFile:." I'm not sure offhand why this would be, and it is a bummer, but the "workaround" is to just do the unarchiving symmetrically to the archiving, that is read the file into an NSData and then unarchive that using -decodeObject (or - decodeObjectForKey: if you encode with your own root key(s) after all). I'll note that I haven't tested this myself again, but that seems to be what the documentation is saying.

-natevw_______________________________________________

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


  • Follow-Ups:
    • Re: NSKeyedArchiever and XML Format
      • From: Martin Wierschin <email@hidden>
References: 
 >NSKeyedArchiever and XML Format (From: Patrick Mau <email@hidden>)
 >Re: NSKeyedArchiever and XML Format (From: Nathan Vander Wilt <email@hidden>)
 >Re: NSKeyedArchiever and XML Format (From: Martin Wierschin <email@hidden>)

  • Prev by Date: Re: NSKeyedArchiever and XML Format
  • Next by Date: Re: NSKeyedArchiever and XML Format
  • Previous by thread: Re: NSKeyedArchiever and XML Format
  • Next by thread: Re: NSKeyedArchiever and XML Format
  • Index(es):
    • Date
    • Thread