I'm working on a game and I'd like to give a non-developer friend a little level editor so they can build levels while I continue working on the development.
I quickly knocked up the following to see if it would create a file my friend could copy and email to me for later use.
// Archive Test
NSMutableDictionary *leveldata = [NSDictionary
dictionaryWithObjectsAndKeys:
@"This is value 1", @"key1",
@"This is value 2", @"key2",
nil];
NSData *myData = [NSKeyedArchiver archivedDataWithRootObject:gamestate];
if([myData writeToFile:@"gamestate.bin" atomically:YES]){
NSLog(@"SAVED");
}else{
NSLog(@"FAIL SAVE");
}
According to the log, it's been saved. However, I've no idea where, I assume into the applications tmp or document directory. But is there anyway I can tweak this to make that saved data accessible outside of the simulator, or is there another approach I should take?