I am trying to load HTTP links within UIWebView. The links are from my website so they are reliable. I have searched the internet and found the solution here: How can I add NSAppTransportSecurity to my info.plist file?
After following that solution my info.plist looks like this.:
Even after making the changes I cannot load HTTP links within UIWebView. I get the following error:
App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure
Is there something I am doing wrong?
UPDATE:
After making the changes suggested by Ramshad in comments it still does not work. See image below:
Safari browser installed in iOS & webview browser (if safari) are same or there are difference?
WKWebView replaces the UIWebView class in iOS 8 and later, and it replaces the WebView class in macOS 10.10 and later. Embed a WKWebView object programmatically into your view hierarchy, or add it using Interface Builder.
First, enable the Safari Web Inspector on your iOS device by opening the iOS Settings app, navigating to Settings > Safari > Advanced, and toggling the Web Inspector option on.
As of iOS 12.0, 'UIWebView' has been explicitly marked as deprecated. Apple is encouraging developers to adopt WKWebView instead, which was introduced in iOS 8.0.
Check this article: link.
App Transport Security (ATS) normally doesn’t allow our apps to connect to HTTP servers, but there’s a special exception you can add to allow UIWebView and WKWebView to load insecure content.
TL;DR
Just add to your .plist
file:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
NSAllowsArbitraryLoadsInWebContent
is available from iOS 9.0 so should be fine for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With