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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to