My mistake for not being clear: I have an NSData in an object; I read that data using a keyedArchiver to get to the chunk I want.
I want to replace a chunk of that data with another using the same key. (the file part is immaterial). On May 18, 2010, at 2:10 PM, Jens Alfke wrote: > > On May 18, 2010, at 1:40 PM, Matthew Weinstein wrote: > >> 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? > > I’m not sure I understand. Were you expecting the code you posted to write to > the file? But nowhere in that code did you specify what file to write to. > Archivers don’t directly know about files; they work on in-memory data. (Yes, > there are convenience class methods for reading and writing a file, but they > just call NSData methods to transfer the data to/from a file.) > > It sounds like what you want to do is call [NSKeyedArchiver > archiveRootObject: obj toFile: file]. > > —Jens _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
