首页 > 其他 > 详细

在沙盒中创建文件方法

时间:2015-08-10 23:43:38      阅读:300      评论:0      收藏:0      [点我收藏+]

 

 

 

 

 

 

 1 - (void)creatPlistFile{
 2     NSArray *array = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,YES);
 3     NSString *path = [array objectAtIndex:0];
// 拼接
phoneContact.plist时,有的Xcode不加/也行
 4 plistPath = [path stringByAppendingString:@"/phoneContact.plist"];
5 NSFileManager *fileManager = [[NSFileManager alloc]init]; 6 if (![fileManager fileExistsAtPath:plistPath]) { 7 BOOL isOk = [fileManager createFileAtPath:plistPath contents:nil attributes:nil]; 8 if (isOk) { 9 NSLog(@"创建成功"); 10 } 11 else{ 12 NSLog(@"创建失败"); 13 } 14 } 15 }

 

在沙盒中创建文件方法

原文:http://www.cnblogs.com/doublelongliu/p/4719485.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!