iOS macOS plist的基本操作
//找到本地plist文件路径
//如果返回路径为空,解决方法: 在Targets -> Build Phases -> Copy Bundle Resources里面导入资源文件,运行项目
NSString *localPlistPath = [[NSBundle mainBundle] pathForResource:@"AppConfiguration" ofType:@"plist"]; //查看一下所有内容 NSMutableDictionary *data = [[NSMutableDictionary alloc]initWithContentsOfFile:localPlistPath]; NSLog(@"查看一下所有内容000:%@",data); [data setObject:@"off" forKey:@"NoTipsNextTime"];//修改数据 [data setObject:@"adddata" forKey:@"bbb"];//插入数据bbb [data removeObjectForKey:@"sss"];//删除数据sss [data writeToFile:localPlistPath atomically:YES];//确认写入