可以在整个iphone中搜索pdf文件吗?

发布于 2024-12-18 21:33:49 字数 392 浏览 0 评论 0原文

我想搜索整个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月静好 2024-12-25 21:33:49

每个应用程序(及其关联的文件)都在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文