I'm creating an app that allows you to log board game plays. I'm storing my logs in a plist and I'm trying to figure out how to append the plist. I think I understand the logic but I'm having trouble putting it into code.
My plist looks like so:
Right now I'm trying something like this but I believe it will simply overwrite the plist file instead of appending
//get path for root directory
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSLog(@"paths: %@",paths);
//get path for documents directory
NSString *documentsPath = [paths objectAtIndex:0];
NSLog(@"documentsPath: %@",documentsPath);
//get the path for logs.plist file
NSString *plistPath = [documentsPath stringByAppendingPathComponent:@"logs.plist"];
//create dictionary with values
NSDictionary *plistDict = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:myLogTitle, name, players, myNotes, nil] forKeys:[NSArray arrayWithObjects:@"Log Title",@"Name",@"Players","Notes", nil]];
//write out data
[plistDict writeToFile:plistPath atomically:YES];
Any help would be really appreciated.