本文介绍了在Objective-C / cocoa中创建文件夹/目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个代码在Objective-C /可可中创建文件夹/目录。
I have this code for creating a folder/directory in Objective-C/cocoa.
if(![fileManager fileExistsAtPath:directory isDirectory:&isDir])
if(![fileManager createDirectoryAtPath:directory attributes:nil])
NSLog(@"Error: Create folder failed %@", directory);
它工作正常,但我有 creatDirectoryAtPath:attributes已过时
警告消息。
在Cocoa / Objective-c中创建目录构建器的最新方法是什么?
It works fine, but I got creatDirectoryAtPath:attributes is deprecated
warning message.What's the newest way of making a directory builder in Cocoa/Objective-c?
BOOL isDir;
NSFileManager *fileManager= [NSFileManager defaultManager];
if(![fileManager fileExistsAtPath:directory isDirectory:&isDir])
if(![fileManager createDirectoryAtPath:directory withIntermediateDirectories:YES attributes:nil error:NULL])
NSLog(@"Error: Create folder failed %@", directory);
推荐答案
在文档中找到大约30秒:
About 30 seconds in the documentation found:
这篇关于在Objective-C / cocoa中创建文件夹/目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!