如何更新ios系统中的plist文件



我正在开发一个应用程序。我正试图使用下面的代码更新plist文件。

 plist_path=[[NSBundle mainBundle]pathForResource:@"Configurationfile" ofType:@"plist"];
 config_dict=[[NSMutableDictionary alloc]initWithContentsOfFile:plist_path];
[config_dict setValue:textField.text forKey:@"ServerURL"];
NSLog(@"%@",config_dict);
[config_dict writeToFile:plist_path atomically:YES];
[config_dict release];

但是它不起作用。但是NSlog显示字典中每个键的正确值。请帮我如何更新plist文件

你不能更新应用包中的文件。而是将文件复制到工作目录并在那里更新。

最新更新