I'm reading a file like so:
NSData *data = [NSData dataWithContentsOfFile:myPath];
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
NSData *imgData = [unarchiver decodeObjectForKey:@"myimage"];
if (imgData != nil) {
self.image = [[NSImage alloc]initWithData:imgData];
}else{
self.image = nil;
}
[unarchiver finishDecoding];
[unarchiver release];
What I'd like to do is to append image data for key @"myimage" to the same file if it doesn't exist.
How to go about it?