gpt4 book ai didi

iphone - 在 iPhone 中创建一个目录

转载 作者:行者123 更新时间:2023-12-03 20:17:46 28 4
gpt4 key购买 nike

这有什么问题吗?

#define AUDIO_NOTES_FOLDER [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/myApp/Pictures"]

NSFileManager *NSFm= [NSFileManager defaultManager];
BOOL isDir=YES;

if(![NSFm fileExistsAtPath:FILEPATH isDirectory:&isDir])
if(![NSFm createDirectoryAtPath:FILEPATH attributes:nil])
NSLog(@"Error: Create folder failed");

最佳答案

createDirectoryAtPath:attributes: 已弃用,您应该使用:

    NSString *dirToCreate = [NSString stringWithFormat:@"%@/newDirectory",[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]];
NSError *error = nil;
BOOL isDir;
if(![fm fileExistsAtPath:dirToCreate isDirectory:&isDir])
if(![fm createDirectoryAtPath:dirToCreate withIntermediateDirectories:YES attributes:nil error:&error])
NSLog(@"Error: Create folder failed");

关于iphone - 在 iPhone 中创建一个目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1338256/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com