Re: Coding object version with non-keyed (un)archiver
Re: Coding object version with non-keyed (un)archiver
- Subject: Re: Coding object version with non-keyed (un)archiver
- From: Scott Anguish <email@hidden>
- Date: Tue, 12 Aug 2003 00:15:01 -0400
On Monday, August 11, 2003, at 6:38 PM, Simon Bovet wrote:
I though that [MyClass version] would return the version of MyClass as
it was when encoded... Actually, I need to use -[NSCoder
versionForClassName:] insteed. Do I miss something? When then should
[NSObject version] be used? Thanks for any help or comment on my code
below.
You can't do what you're doing in the initWithCoder: example you
included. you're already decoding it, so you can't then go back and
decode it.
You need to write out your own file or class version information (some
number is all that is needed) at the beginning of each object you
encode.. then you read that single version field, and decide what
elements you can load.
This gives you backwards compatibility with older files.
NB: I do not use keyed archiver on purpose! They are much too slow
when hundred of objects need to be encoded...
Even when you elect to use the binary storage format?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.