问题
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