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

NSKeyedArchiver: confusion


  • Subject: NSKeyedArchiver: confusion
  • From: Matthew Weinstein <email@hidden>
  • Date: Tue, 18 May 2010 13:40:10 -0700

Dear Cocoa-dev,
I'm trying to use a keyed archiver to manipulate a file without actually opening it. Everything seems fine at first: I get the data, I copy it into a NSMutableData object, I init a NSKeyedUnarchiver and get the data I need; I create a new object with the old data (an array of dictionaries) with just a couple of the keys changed. I dump the new array of modified dictionaries and everything looks great. I then try to archive it using the following (where theData is my NSMutableData inited with data in a file).


    masterOutArray = [[NSKeyedArchiver alloc] initForWritingWithMutableData: theData];
    [masterOutArray setOutputFormat: NSPropertyListXMLFormat_v1_0];
     [masterOutArray encodeObject: myRecs forKey: @"codedDataArray"];
    [masterOutArray finishEncoding];
    [masterOutArray release];

The problem: The old @"codedDataArray" is not replaced! When I open the file the old junk is all there. The old array is not discarded and replaced with the new (myRecs) array. So I cannot use NSKeyedArchiver like an NSMutableDictionary?

Hoping for clarity and possible approaches....

Thanks,

Matthew Weinstein


Matthew Weinstein
Associate Professor of Science Education
Education Program
U.W. - Tacoma
253 692-4787

email@hidden

Campus Box: 358435
1900 Commerce Street
Tacoma, WA  98402-3100
Office:  (253) 692-4787
FAX:     (253) 692-5612



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: confusion
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: Why I can't see my localized nib?
  • Next by Date: Re: NSKeyedArchiver: confusion
  • Previous by thread: Solved!! NSLog issue with NSTask Bash commands Re: Solved BUT How to get NSLog back - Re: NSTask and piped commands -
  • Next by thread: Re: NSKeyedArchiver: confusion
  • Index(es):
    • Date
    • Thread