iPhone SDK Xcode - 如何获取文档目录中的所有文件名 [英] iPhone SDK Xcode - How to get all the filenames in the documents dir
本文介绍了iPhone SDK Xcode - 如何获取文档目录中的所有文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获取应用程序的文档
文件夹中的所有文件名,并将它们放在 NSMutableArray
中。没有更多,没有更少。
I want to get all the filenames in my application's documents
folder, and place them in an NSMutableArray
. Nothing more, nothing less.
推荐答案
NSFileManager
:
NSFileManager *fileManager = [[NSFileManager alloc] init];
NSArray *files = [fileManager contentsOfDirectoryAtPath:documentsDirectory
error:nil];
...
[fileManager release];
从ARC开始,您当然可以删除发布声明。
As of ARC you can of course drop the release statement.
这篇关于iPhone SDK Xcode - 如何获取文档目录中的所有文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文