Re: Archiving and Dearchiving
Re: Archiving and Dearchiving
- Subject: Re: Archiving and Dearchiving
- From: email@hidden
- Date: Thu, 27 Mar 2003 10:46:40 -0800 (PST)
Thanks for the reply Marco,
while archiving I use the following code:
data = [NSMutableData data];
archiver = [[NSKeyedArchiver alloc] initForWritingWithMutable
Data:data];
[archiver setOutputFormat: NSPropertyListXMLFormat_v1_0];
[archiver encodeRootObject:_myRootObect forKey:@"RootObject"];
[archiver finishEncoding];
result = [data writeToFile:@"archive.xml" atomically:YES];
[archiver release];
to decode it I used:
_myRootObject = [NSKeyedUnarchiver unarchiveObjectWithFile:@"archive.xml"];
after this line _myRootObject is nil. If on the other hand I archive/dearchive
using:
[NSKeyedArciver archiveRootObject: _myRootObject toFile:@"archive.bin"];
_myRootObject = [NSKeyedUnarchiver unarchiveObjectWithFile:@"archive.bin"];
it works!
can you maybe help out in detecting what I'm doing wrong. The only thing I can
imagine is that the NSKeyedUnarchiver is looking for a binary file but it finds
an XML file and doesn't now how to deal with it.
Zameer
On Thu, 27 Mar 2003 10:38:44 -0800 (PST), Marco Binder wrote:
>
>
You dont have to specify it at all! NSUnArchiver will do virtually all
>
the work for you. Read Bill Cheesman's article on keyed archiving on
>
stepwise!
>
>
Marco
>
>
>
Am Donnerstag, 27.03.03 um 10:16 Uhr schrieb email@hidden:
>
>
> hello,
>
>
>
> The documents for NSKeyedArchiver allows me to specify the output
>
> format. One
>
> of the options is to use XML.
>
>
>
> When I try to de-archive this file, how do I specify that the format
>
> of the
>
> input file is XML?
>
>
>
> I have looked all over and can't find this.
>
>
>
> any help would be appreciated
>
>
>
> thanks
>
>
>
> Zameer
>
>
>
> __________________________________________________________
>
> Get your FREE personalized e-mail at <a
href="
http://mail.canada.com/jump/http://www.canada.com">
http://www.canada.com</a>
>
> _______________________________________________
>
> cocoa-dev mailing list | email@hidden
>
> Help/Unsubscribe/Archives:
>
> <a
href="
http://mail.canada.com/jump/http://www.lists.apple.com/mailman/listinfo/cocoa-dev">
http://www.lists.apple.com/mailman/listinfo/cocoa-dev</a>
>
> Do not post admin requests to the list. They will be ignored.
>
>
>
>
>
--
>
|\ /| 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 _____________________________________________________
__________________________________________________________
Get your FREE personalized e-mail at
http://www.canada.com
_______________________________________________
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.