在使用contentsOfDirectoryAtPath获取目录中的所有文件/目录时出现问题
||
我有一个zip文件,我将其解压缩到Documents目录下的目录\'extract \'中(目录及其内容已正确创建)。然后,我将对新目录中的每个项目进行一些处理,如果它是文件或目录,则可能会有所不同。我使用NSFileManager的“ 0”方法。
问题是数组
extractedItems
总是返回空值,我不知道自己在搞错什么。
NSString *dirnameForUnzippedData = [[NSString alloc] initWithString:@\"extract\"];
NSString *dirpath = [documentsDirectory stringByAppendingPathComponent:dirnameForUnzippedData];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *extractedItems = [fileManager contentsOfDirectoryAtPath:dirnameForUnzippedData error:NULL];
for (NSString *item in extractedItems) { ... }
没有找到相关结果
已邀请:
1 个回复
课刊灭似
(或
)。 附带说明一下,使用完后不要忘了
dirnameForUnzippedData-或只是
而不是alloc / init。