我使用以下代码修改plist但无济于事:
-(IBAction)modifyPlist:(id)sender{
NSBundle *mainBundle=[NSBundle mainBundle];
NSString *path=[mainBundle pathForResource:@"Preferences" ofType:@"plist"];
NSMutableDictionary* dict = [NSMutableDictionary dictionaryWithContentsOfFile:path];
[dict setValue:@"YES" forKey:@"test"];
[dict writeToFile:path atomically:YES];
}
有谁知道为什么它不将 plist 值“test”从 NO 更改为 YES?
最佳答案
长话短说:因为您无法写入应用程序包。
关于objective-c - 为什么这不起作用? - 将数据写入plist,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27037391/