iOS 文件目录
来源:互联网 发布:淘宝售后多久不能申请 编辑:程序博客网 时间:2024/06/15 14:15
//模拟器下 XXX.APP的目录------添加到项目的东西 这里的东西不能写
//模拟器的家目录
NSString *homePath = NSHomeDirectory();
NSLog(@"%@",homePath);
//模拟器下 XXX.APP的目录
NSBundle *bundle = [NSBundlemainBundle];
NSLog(@"%@",bundle);
NSString *plistPath = [bundle pathForResource:@"test" ofType:@"plist"];
NSLog(@"%@",plistPath);
//文件管理
NSFileManager *fileMg = [NSFileManagerdefaultManager];
if([fileMg fileExistsAtPath:plistPath])
{
//字典读取
NSMutableDictionary *dic = [NSMutableDictionarydictionaryWithContentsOfFile:plistPath];
NSLog(@"%@",dic);
}
else
{
NSLog(@"file not exist");
}
//操作Document 可读写
NSArray *array =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);//如果为NO则文件写不进去
NSString *docPath = [array objectAtIndex:0];
NSLog(@"%@",docPath);
//构造路劲
NSString *appendPath = [NSStringstringWithFormat:@"%@/hello.txt",docPath];
NSLog(@"%@",appendPath);
NSString *str = [NSStringstringWithFormat:@"hello world"];
//写入文件
[str writeToFile:appendPathatomically:YESencoding:NSUTF8StringEncodingerror:nil];
- ios 文件目录结构
- ios 文件/目录操作
- iOS 文件目录
- 获取iOS文件目录
- ios 文件目录结构
- iOS文件目录结构
- ios 文件目录
- iOS 文件目录操作
- iOS文件目录结构
- iOS文件目录
- IOS 文件目录
- iOS文件目录结构
- ios 获取文件目录
- IOS管理文件和目录
- IOS管理文件和目录
- ios NSFileManager创建目录、文件
- iOS沙盒文件目录
- IOS管理文件和目录
- 指针与数组的异同
- 如何记住滚动条的位置
- linux c 线程池(互斥变量+条件变量+模块化实现)(V1.0)
- dwr json小例子(只有前端到后端的流程)
- 合并单链表,输出单链表中间元素,判断是否有环等
- iOS 文件目录
- 家庭理财通
- URAL1021:简单问题的巧妙解答
- VS LNK2019 解决办法之一
- PCA(主成分分析)--- 从最小平方误差角度分析
- C语言学习之指针
- python的字符串处理
- hduoj 1708
- 手机IMEI号介绍