Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 476
Will Avatar asked Sep 15 '15 04:09

Will


1 Answers

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.

like image 80
Eric Herring Avatar answered Oct 29 '22 09:10

Eric Herring