我想搜索整个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'"]];
最佳答案
每个应用程序(及其关联文件)都在 iOS 下沙箱化,因此您将无法访问除您自己的应用程序生成的文件之外的文件。
即:这是不可能的。
关于iphone - 可以在整个iphone中搜索pdf文件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8307475/