1

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 *)coderand - (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?

Yashman
  • 111
  • 1
  • 11

1 Answers1

1

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

Jef
  • 4,728
  • 2
  • 25
  • 33