博客> 沙盒document创建文件夹
沙盒document创建文件夹
2019-06-25 11:45 评论:0 阅读:717 企鹅会飞
ios 沙盒 document

NSFileManager fileManager = [[NSFileManager alloc] init]; NSString pathDocuments = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *createPath = [NSString stringWithFormat:@"%@/%@", pathDocuments,aUser.userId];

// 判断文件夹是否存在,不存在创建
if (![[NSFileManager defaultManager] fileExistsAtPath:createPath]) {
    [fileManager createDirectoryAtPath:createPath withIntermediateDirectories:YES attributes:nil error:nil];
    [fileManager createDirectoryAtPath:createDir withIntermediateDirectories:YES attributes:nil error:nil];
} else {
    NSLog(@"File is exists.");
}
收藏
0
sina weixin mail 回到顶部