Plist只是不会保存自己......
我不明白我在这里做错了什么。请帮忙。
NSString *factorsFile = [[NSBundle mainBundle]pathForResource:@"factors" ofType:@"plist"];
NSMutableArray *factorsArray = [NSMutableArray arrayWithContentsOfFile:factorsFile];
NSMutableDictionary *dictFactor = [NSMutableDictionary dictionary];
[dictFactor setObject:self.nameField.text forKey:@"Factor"];
[dictFactor setObject:self.rankField.text forKey:@"Rank"];
NSLog(@"%@",dictFactor);
[factorsArray addObject:dictFactor];
NSLog(@"%@",factorsArray);
if([factorsArray writeToFile:factorsFile atomically:YES]){
NSLog(@"lalal");
}
此代码能够进入最后一个 if 循环,但 plist 保持不变......为什么?