可以在整个iphone中搜索pdf文件吗?
我想搜索整个 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'"]];
I want to search each and every pdf files on whole iphone.Is it possible in iphone sdk?
I have tried following code but it is giving our own application's files.
NSString *bundleRoot = [[NSBundle mainBundle] bundlePath];
NSArray *dirContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:bundleRoot error:nil];
NSArray *onlyPDFs = [dirContents filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"self ENDSWITH '.pdf'"]];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
每个应用程序(及其关联的文件)都在 iOS 下沙箱中,因此您将无法访问除您自己的应用程序生成的文件之外的文件。
即:这是不可能的。
Each application (and its associated files) are sandboxed under iOS, hence you won't be able to access files other than those produced by your own application.
i.e.: This isn't possible.