gpt4 book ai didi

objective-c - 为什么这不起作用? - 将数据写入plist

转载 作者:行者123 更新时间:2023-12-03 17:50:53 25 4
gpt4 key购买 nike

我使用以下代码修改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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com