我想以编程方式将新行添加到我的pList文件在iPhone上。但我无法找出如何。 我要添加键值:someKey /类型:字符串/ someValue中:字符串
添加新的键/字符串的值pList
NSString *path = [[NSBundle mainBundle] pathForResource:@"MyPlist" ofType:@"plist"];
NSMutableDictionary *plist = [[NSDictionary dictionaryWithContentsOfFile:path] mutableCopy];
NSMutableArray *newArray = [[[NSMutableArray alloc] init] autorelease];
newArray = [NSArray arrayWithObjects:@"someKey", @"someValue", nil];
[plist setObject:newArray forKey:@"someKey"];
[plist writeToFile:path atomically:YES];
[plist release];