在iOS中的Safari中打开本地PDF [英] Open Local PDF in Safari in iOS

查看:605
本文介绍了在iOS中的Safari中打开本地PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设myURL指向通过执行以下操作获得的PDF:

Let's say that myURL pointed to a PDF which was obtained by doing:

myURL = [[NSBundle mainBundle] URLForResource:@"my" withExtension:@"PDF"];

我可以调用[[UIApplication sharedApplication] canOpenURL:myURL]并看到它返回YES。

I can call [[UIApplication sharedApplication] canOpenURL:myURL] and see that it returns YES.

然而,当我调用 [[UIApplication sharedApplication] openURL:myURL] 时,没有任何反应,它返回NO。

However, when I call [[UIApplication sharedApplication] openURL:myURL], nothing happens and it returns NO.

有没有办法让这个工作?

Is there a way to have this work?

是的,我知道我可以使用UIWebView让它打开PDF,但在这种情况下,我需要Safari应用程序打开它,如果可能的话。我知道这将导致它退出我的应用程序的自然结果。在这种情况下,这种行为是可以接受的。

Yes, I know I could use a UIWebView to have it open the PDF, but in this instance, I need the Safari App to open it, if possible. I am aware the natural consequence of this will be for it to exit my application. This behavior would be acceptable in this case.

谢谢。

推荐答案

目前无法实现。

这篇关于在iOS中的Safari中打开本地PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆