UIWebView does not show images on iOS9, and SafariViewController does not load HTML files at all?

杀马特。学长 韩版系。学妹 提交于 2019-12-23 15:34:51

问题


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.

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', reason: 'The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported'

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

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


回答1:


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>

Check out this answer for more help.



来源:https://stackoverflow.com/questions/32577727/uiwebview-does-not-show-images-on-ios9-and-safariviewcontroller-does-not-load-h

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!