本文介绍了UIWebView在iOS9上不显示图像,而SafariViewController根本不加载HTML文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

仅发现加载带有嵌入图像的HTML字符串的 UIWebView 无法在 iOS9 (GM种子)上正确显示图像,而以前在 iOS9上可以正常工作> iOS8 .

Just found that UIWebView that load HTML string with images embedded does not work correctly to show the image on iOS9 (GM seed), which worked correctly previously on iOS8.

在观看WWDC SafariViewController视频后此处,并认为Apple想要我们转向新的框架,它看起来很有希望.但是问题在于,SafariViewController不支持加载本地HTML文件,它仅支持HTTP和HTTPS,到目前为止,在 iOS9 GM种子和Xcode 7.1 beta上.我试图使用指向本地文件的NSURL加载它,抛出了异常:

After viewed the WWDC SafariViewController video here and thought Apple wants us to turn to the new framework, which looks quite promising. But problem is SafariViewController does not support loading local HTML files and it only supports HTTP and HTTPS, so far on iOS9 GM seed and Xcode 7.1 beta. I tried to load it using NSURL pointing to the local file, exception thrown:

"NSInvalidArgumentException",原因:指定的URL不受支持的方案.仅支持HTTP和HTTPS URL".

有人在 iOS9 上看到与 UIWebView 相同的问题以及任何解决方法吗?谢谢.

Does anyone see same issue with UIWebView on iOS9 and any walkaround? Thanks.

关于SafariViewController问题,我已就此向苹果公司的Ricky进行了ping操作,并提出了功能请求,希望此问题能尽快得到解决.

About SafariViewController issue, I have pinged Ricky at Apple about this and filed a feature request, hopefully this will be addressed soon.

推荐答案

通过在plist文件中设置以下内容,您应该仍然可以使用UIWebView并关闭App Transport Security:

You should be able to still use UIWebView and turn off the App Transport Security by setting the following in your plist file:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

查看此 answer 获得更多帮助.

这篇关于UIWebView在iOS9上不显示图像,而SafariViewController根本不加载HTML文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 21:09