我有一个具有下一个结构的 plist:
-root (dictionary)
-windows (array)
我需要像这样将项目添加到行窗口中:
-root (dictionary)
-windows (array)
-item0 value 1
-item1 value 2
我有这些行:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"Windows.plist"];
NSMutableDictionary *data = [[NSMutableDictionary alloc] initWithContentsOfFile: path];
[data setObject:idWindow forKey:@"Windows"];
[data writeToFile: path atomically:YES];
但他们只将 Window 行的类型更改为字符串并写入我插入的最后一个值。
我怎样才能做到这一点?
坦克