how to update the plist file in ios [duplicate]

*爱你&永不变心* 提交于 2019-12-25 19:45:22

问题


I am developing one application.In that i am trying to update the plist file using below code.

 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];

But it's not working.But NSlog showing the correct values for every key in the dictionary.Please help me how to update the plist file.


回答1:


You cannot update the files within the app bundle. Instead copy the files to a working directory and update them there.



来源:https://stackoverflow.com/questions/16870092/how-to-update-the-plist-file-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!