RE: Losing data with new archiving method?
RE: Losing data with new archiving method?
- Subject: RE: Losing data with new archiving method?
- From: "Jonathan E. Jackel" <email@hidden>
- Date: Mon, 10 Jun 2002 15:56:12 -0400
Cocoa does the versioning work for you. Use +setVersion: (NSObject) to set
the version number of your custom class. The version is archived along with
your objects. Your decoder would then use +version: in an if or switch
structure to properly handle "legacy" data files.
Jonathan
>
-----Original Message-----
>
From: email@hidden
>
[mailto:email@hidden]On Behalf Of Donald Brown
>
Sent: Monday, June 10, 2002 2:26 PM
>
To: Thilo Ettelt; Cocoa dev
>
Subject: Re: Losing data with new archiving method?
>
>
>
Somehow, your code has to realize that it's reading an old file, and thus
>
not read the objects in question. Or, you could write a
>
converter app that
>
reads the old, and writes the new, stuffing default data for the missing
>
objects.
>
>
What I've been doing is wrapping all my data up into an object
>
(one of whose
>
members is the array with data items). The first thing
>
encoded/decoded is a
>
16 bit integer with the version number of the file, and the rest
>
of the code
>
checks the version number to decide how much to read.
>
>
Donald
>
>
on 6/10/02 1:14 PM, Thilo Ettelt at email@hidden wrote:
>
>
> Hi! I've run into a little trouble. I'm archiving an NSMutableArray with
>
> Classes that own a couple of objects. Now I have added a few objects to
>
> these classes. So more objects are being encoded and decoded.
>
> Unfortunately I'm not able to get the data from former archived data
>
> anymore without getting an Exception? Or is there a method to get it?
>
>
>
> Thanks in advance!
>
>
>
>
>
> Cheers, Thilo
>
> _______________________________________________
>
> 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.
>
>
--
>
Donald Brown
>
email@hidden
>
http://www.eamontales.com
>
>
We have met the enemy and he is us - Pogo
>
_______________________________________________
>
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.
_______________________________________________
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.