美文网首页
如何获取沙盒文件夹地址

如何获取沙盒文件夹地址

作者: 苍氺灏 | 来源:发表于2016-03-31 21:28 被阅读0次

在iOS 中 想要获取沙盒中 的路径

第一种获取文件夹的地址的方式

[NSSearchPathForDirectoriesInDomains ( NSLibraryDirectory,NSUserDomainmask , YES ) objectAtIndex:0];

这是一个 直接获取 沙盒内文件夹的方式 , 但是 却没有办法 获取 tmp 文件

 第二种获取文件夹地址的方式

NSString *homePathStr = NSHomeDirectory();

NSString *documentPathStr = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Preferences"];

NSLog(@"%@",documentPathStr);

相较第一种方法 第二种方法采用拼接的方法能获取想要的文件

相关文章

网友评论

      本文标题:如何获取沙盒文件夹地址

      本文链接:https://www.haomeiwen.com/subject/jmhdlttx.html