向info.plist文件中写入数据(nsdictionary)
来源:互联网 发布:dm800台标编辑软件 编辑:程序博客网 时间:2024/05/29 08:48
plist 文件读写
//1. 创建一个plist文件
NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *path=[paths objectAtIndex:0];
NSLog(@"path = %@",path);
NSString *filename=[path stringByAppendingPathComponent:@"test.plist"];
NSFileManager* fm = [NSFileManager defaultManager];
[fm createFileAtPath:filename contents:nil attributes:nil];
//NSDictionary* dic = [NSDictionary dictionaryWithContentsOfFile:plistPath];
//创建一个dic,写到plist文件里
NSDictionary* dic = [NSDictionary dictionaryWithObjectsAndKeys:@"sina",@"1",@"163",@"2",nil];
[dic writeToFile:filename atomically:YES];
//读文件
NSDictionary* dic2 = [NSDictionary dictionaryWithContentsOfFile:filename];
//1. 创建一个plist文件
NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *path=[paths objectAtIndex:0];
NSLog(@"path = %@",path);
NSString *filename=[path stringByAppendingPathComponent:@"test.plist"];
NSFileManager* fm = [NSFileManager defaultManager];
[fm createFileAtPath:filename contents:nil attributes:nil];
//NSDictionary* dic = [NSDictionary dictionaryWithContentsOfFile:plistPath];
//创建一个dic,写到plist文件里
NSDictionary* dic = [NSDictionary dictionaryWithObjectsAndKeys:@"sina",@"1",@"163",@"2",nil];
[dic writeToFile:filename atomically:YES];
//读文件
NSDictionary* dic2 = [NSDictionary dictionaryWithContentsOfFile:filename];
NSLog(@"dic is:%@",dic2);
- 向info.plist文件中写入数据(nsdictionary)
- iOS学习爬坑记录3:plist文件的读写,以及向NSMutableArray中写入NSDictionary元素失败
- 第十六章,向txt文件中写入数据(C++)
- 向存在的文件中写入数据
- C++ 向文件中写入一组数据
- C++向文件中写入数据
- PHp向文件中写入数据
- 向记录文件中写入数据
- Info.plist文件中重要的键
- IOS工程中Info.plist文件详解
- iOS中Info.plist文件常用属性
- iOS 10中info.plist 文件 Privacy
- NSDictionary 读写 plist 文件
- info.plist文件错误
- iOS Info.plist文件
- iOS info.plist文件
- 获取info.plist文件
- Info.plist文件简介
- [转]java中byte转换int时为何与0xff进行与运算
- CentOS下Redis 2.2.14安装配置详解
- 获取android 屏幕宽度高度
- 块设备驱动程序
- Hash Table
- 向info.plist文件中写入数据(nsdictionary)
- VC编程中20种各种编程技巧和方法
- 算法:选择排序算法。
- hdu1576 A/B (扩展欧几里德)
- sublime各种配置
- 我们应该怎样做好博客的SEO优化排名
- C获取自身进程名称
- 与IO相关的等待事件troubleshooting-系列1
- 【技术文档】《编程珠玑》Jon Bentley·第9章 代码调优