码迷,mamicode.com
首页 > 移动开发 > 详细

IOS常用获取沙盒路径,URL方法

时间:2014-12-14 14:37:22      阅读:472      评论:0      收藏:0      [点我收藏+]

标签:ios   document   沙盒   路径   url   

获得沙盒Documents文件夹路径
1:
<span style="font-size:18px;"> NSArray *searchPach = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
   NSString *path1 = [[searchPach firstObject] stringByAppendingPathComponent:@"file1"];</span>
   
2:
  
 NSFileManager *manager = [NSFileManager defaultManager];
    NSURL *url = [[manager URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] firstObject];
    NSURL *path2 = [url URLByAppendingPathComponent:@"MyDocument"];
    UIManagedDocument *managedDocument = [[UIManagedDocument alloc]initWithFileURL:path2];

3:
 
NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/text.txt”];

IOS常用获取沙盒路径,URL方法

标签:ios   document   沙盒   路径   url   

原文地址:http://blog.csdn.net/sinat_19587549/article/details/41924693

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