我想以編程方式將新行添加到我的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];