【发布时间】:2011-11-29 07:56:57
【问题描述】:
我想在整个 iphone 上搜索每一个 pdf 文件。在 iphone sdk 中可以吗? 我尝试了以下代码,但它提供了我们自己的应用程序文件。
NSString *bundleRoot = [[NSBundle mainBundle] bundlePath];
NSArray *dirContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:bundleRoot error:nil];
NSArray *onlyPDFs = [dirContents filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"self ENDSWITH '.pdf'"]];
【问题讨论】:
标签: iphone nsfilemanager