• 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
NSKeyedArchiver not saving as binary data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSKeyedArchiver not saving as binary data
      • From: Ali Ozer <email@hidden>
  • Prev by Date: Re: Lucene/Cocoa integration
  • Next by Date: [Moderator] EOT Re: WWDC 2007
  • Previous by thread: Re: Lucene/Cocoa integration
  • Next by thread: Re: NSKeyedArchiver not saving as binary data
  • Index(es):
    • Date
    • Thread