码迷,mamicode.com
首页 > 其他好文 > 详细

沙盒路径

时间:2015-10-04 00:28:08      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:

沙盒路径

//主目录,方法一
NSString *path = NSHomeDirectory();
NSLog(@"NSHomeDirectory:%@",path);
//主目录,方法二
NSString *userName = NSUserName();
NSString *rootPath = NSHomeDirectoryForUser(userName);
NSLog(@"NSHomeDirectoryForUser:%@",rootPath);
//Documents目录
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory=[paths objectAtIndex:0];
NSLog(@"NSDocumentDirectory:%@",documentsDirectory);

打印:

2015-10-03 19:45:27.194 视频[17571:1226155] NSHomeDirectory:/Users/Eazy/Library/Developer/CoreSimulator/Devices/46073ABC-2125-4809-8920-B94B59020799/data/Containers/Data/Application/A0A2182E-D2EE-4C09-BE97-D73E100D252B

2015-10-03 19:45:27.195 视频[17571:1226155] NSHomeDirectoryForUser:/Users/Eazy/Library/Developer/CoreSimulator/Devices/46073ABC-2125-4809-8920-B94B59020799/data/Containers/Data/Application/A0A2182E-D2EE-4C09-BE97-D73E100D252B

2015-10-03 19:45:27.195 视频[17571:1226155] NSDocumentDirectory:/Users/Eazy/Library/Developer/CoreSimulator/Devices/46073ABC-2125-4809-8920-B94B59020799/data/Containers/Data/Application/A0A2182E-D2EE-4C09-BE97-D73E100D252B/Documents
分析:

模拟器UDID:46073ABC-2125-4809-8920-B94B59020799

应用程序UDID:A0A2182E-D2EE-4C09-BE97-D73E100D252B

前往该沙盒路径:

技术分享

Documents:应用主要数据存放在此,itunes会备份

Library/Caches:缓存文件,应用退出不会删除,iTunes不会备份此目录

Library/Preferences:程序偏好设置文件,itunes会备份

tmp:存放临时文件,内存不足时会不定时删除,不建议存放长时间使用的文件,iTunes不会备份此目录

 

 

 

沙盒路径

标签:

原文地址:http://www.cnblogs.com/Eazy/p/4854039.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!