hi all
does anybody know how to add a child key to the root key programmatically in a plist?
sean
hi all
does anybody know how to add a child key to the root key programmatically in a plist?
sean
NSString *path = @"path/to/some/file";
NSMutableDictionary *plist = [[NSDictionary dictionaryWithContentsOfFile:path] mutableCopy];
[plist setObject:@"foo" forKey:@"aKey"];
[plist writeToFile:path atomically:YES];
[plist release];
Note that you cannot write inside your own bundle; you'll have to copy the file to somewhere within your app's sandbox. Check out the NSSearchPathForDirectoriesInDomains
function.