修改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];//保存更改

相关文章:

  • 2022-12-23
  • 2021-08-22
  • 2021-08-01
  • 2021-07-06
  • 2022-02-14
  • 2021-10-22
猜你喜欢
  • 2021-11-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-15
相关资源
相似解决方案