NSKeyedArchiver not saving as binary data
NSKeyedArchiver not saving as binary data
- Subject: NSKeyedArchiver not saving as binary data
- From: "Matt R" <email@hidden>
- Date: Thu, 8 Feb 2007 11:24:08 -0800
Perhaps i'm overlooking something obvious, as is usually the case, but I
cannot get my instance of NSKeyedArchiver to save my files as binary data. I
use setOutputFormat to set it to the binary option, and I've tried the other
settings as well, and have also experimented with re-ordering the code, but
in every case my data is written in a very verbose XML format, and for a
number of reasons I need just the raw binary data written to the file. Can
anyone see what I'm doing wrong here and enlighten me as to my mistake? This
test code is straight from an example in the apple docs ('Archives and
Serializations Programming Guide for Cocoa'), and works fine and saves the
proper data, but just in the wrong format.
any thoughts? thank you
-matt
NSMutableData *data;
NSKeyedArchiver *archiver;
BOOL result;
data = [NSMutableData data];
archiver = [[NSKeyedArchiver alloc]
initForWritingWithMutableData:data];
[archiver setOutputFormat:NSPropertyListBinaryFormat_v1_0];
[archiver encodeObject:myString forKey:@"stringA"];
[archiver encodeInt:variable1 forKey:@"integerA"];
[archiver encodeInt:variable1 forKey:@"integerB"];
[archiver finishEncoding];
result = [data writeToFile:filePath atomically:YES];
[archiver release];
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden