• 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: Martin Wierschin <email@hidden>
  • Date: Thu, 11 Dec 2008 19:19:26 -0800

The problem I had was that I needed to use -[NSUnarchiver decodeClassName:asClassName:] for unarchiving a file previously encoded using the convenience method. Certainly it's possible to use the class method +[NSUnarchiver decodeClassName:asClassName:], but it seems silly to pollute the global archiver class table for a single file.

You can set a delegate on the unarchiver and use:

- (Class) unarchiver:(NSKeyedUnarchiver*) unarchiver cannotDecodeObjectOfClassName:(NSString*) name originalClasses: (NSArray*) classNames;

to avoid this problem. (If I've understood it properly)

That actually would not have helped, because it's an instance method. The whole problem to begin with was that there wasn't any clear way for a manually constructed instance of NSKeyedUnarchiver to decode a file previously saved using the convenience method.


But really, I've no problem here to solve. The file is long gone. I just remember going through the docs at the time and throwing my hands up in frustration that they didn't mention the "root object key" used by the convenience method. I tried "Root" as the key and the plain "decodeObject" method, but neither worked. Thanks to Patrick I now know the key is "root", which I should have tried, but ought to be documented.

~Martin

_______________________________________________

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: Graham Cox <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>)
 >Re: NSKeyedArchiever and XML Format (From: Nathan Vander Wilt <email@hidden>)
 >Re: NSKeyedArchiever and XML Format (From: Martin Wierschin <email@hidden>)
 >Re: NSKeyedArchiever and XML Format (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: NSKeyedArchiever and XML Format
  • Next by Date: Re: Starting Cocoa apps from the command line
  • Previous by thread: Re: NSKeyedArchiever and XML Format
  • Next by thread: Re: NSKeyedArchiever and XML Format
  • Index(es):
    • Date
    • Thread