• 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: Coding object version with non-keyed (un)archiver
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Coding object version with non-keyed (un)archiver (From: Simon Bovet <email@hidden>)

  • Prev by Date: Re: SIGBUS/SIGSEGV error problems
  • Next by Date: Re: Dropping files and folders on the application icon?
  • Previous by thread: Coding object version with non-keyed (un)archiver
  • Next by thread: Re: Message number 3
  • Index(es):
    • Date
    • Thread