I'm working on a document-based app without CoreData. I have a class Player, which is a subclass of NSObject. The class has some variables and I have also properly implemented - (id)initWithCoder:(NSCoder *)coder
and - (void)encodeWithCoder:(NSCoder *)coder
methods. That's how I'm archiving my data:
- (NSData *) dataOfType:(NSString *)aType
error:(NSError **)outError
{
return [NSKeyedArchiver archivedDataWithRootObject:players];
}
(players is an NSMutableArray
holding some instances of the Player class). The saving works absolutely fine. What I would like to know is how I can also archive (and unarchive later) some variables, declared in the Document.h file?
Look into NSFileWrapper, where you can define & implement saving to / initializing from a file type which is a bundle (basically a folder) then you can save your document object alongside this array