如何更新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文件。

您无法更新应用程序包中的文件。 而是将文件复制到工作目录并在那里更新它们。