• 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: Archiving and Dearchiving
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Archiving and Dearchiving


  • Subject: Re: Archiving and Dearchiving
  • From: Marco Binder <email@hidden>
  • Date: Fri, 28 Mar 2003 10:49:29 +0100

[archiver encodeRootObject:_myRootObect forKey:@"RootObject"];

Where does this method come from? I can not find it... And it doesnt make too much sense to me: why would you want a key for a root object?! It will be the only object encoded in an archiver. Either use a plain NSArchiver and call encodeRootObject:... on it, or use an NSKeyedArchiver to encode any number of objects and associate them with keys via encodeObject:... forKey:...

to decode it I used:

_myRootObject = [NSKeyedUnarchiver unarchiveObjectWithFile:@"archive.xml"];


after this line _myRootObject is nil.

I dont know what the exact problem is. Try reading into an NSData object and then use [[NSUnarchiver alloc] initForReadingWithData:....] and then call _myRootObject = [[unarchiver decodeObject] retain].

You should really look into the keyed archiving and unarchiving stuff... if your app's file-format changes, your still on the save side with keyes archiving. Have your read Bill's article? You should...


Marco

PS: If you dont want to use the NSData stuff, try [NSArchiver archiveRootObject:... toFile:...] and [NSUnarchiver unarchiveObjectWithFile:...]


--
|\ /| E-Mail: email@hidden WWW: www.marco-binder.de
| \/ | Telefon: 07531 / 94 19 94 Fax: 07531 / 94 19 92
| |ARCO Snail-Mail: Banater Str. 3 - 78467 Konstanz
BINDER _____________________________________________________
_______________________________________________
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.

  • Prev by Date: NSOpenPanel Path Problem
  • Next by Date: Re: NSOpenPanel Path Problem
  • Previous by thread: Re: Archiving and Dearchiving
  • Next by thread: Re: Archiving and Dearchiving
  • Index(es):
    • Date
    • Thread