NSKeyedArchiver: confusion
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