objective 修改plist文件
修改plist文件 首先必须保证plist文件存在于Library 或者Documents中 建议把plist文件放在Library/Caches中
(问过高手,放在这两个文件中有啥区别,高手说 苹果官方审查制度规定 最好把文件放在Library/Caches 中 ,否则苹果会不允许你的APP上架销售)
NSString *documentPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"]; tempstr = [documentPath stringByAppendingPathComponent:@"menu.plist"]; self.dictionary = [NSMutableDictionary dictionaryWithContentsOfFile:tempstr];//字典必须定义成可变字典
[dictionary setValue:@"dfadf" forKey:@"test"];//更改内容
[dictionary writeToFile:tempstr atomically:YES];//保存更改