Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSUnarchiver question



[sorry if this is a duplicate post- my mail.app hung while sending]

Is there a way to "rollback" a NSCoder? I'm growing a very ad-hoc document format created with NSDocuments writing with NSArchiver archivedDataWithRootObject:.

What I'd like to do is something like this code fragment below. Is this possible? I can't see anything in NSCoder or NSUnarchiver to support this. There must be some design pattern I'm unaware of for doing this type of thing with serialized objects.

-initWithCoder: coder
{
// in a class deep within the object graph &
// in a galaxy far far away
// document features added after document version 1.0
NS_DURING
// v1.1 feature:
[coder decodeValueOfObjCType:@encode(typeof(feature)) at:&(feature)];
NS_HANDLER
feature = MyDefault;
NSLog(@"failed to read feature");
[coder rollback]; //?
NS_ENDHANDLER
// now the next object in the graph can be safely initWithCoder'd
}

TIA again

Alex Rice <email@hidden>
Mindlube Software
http://www.mindlube.com/




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.