Reputation: 3
I want to open the given url in webview without https (Example myDomain.com). I get the
NSURLConnection finished with error - code -1100
error for swift opening url on Android. How can I do it?
let url = URL(string: "myDomain.com")
webView.loadRequest(URLRequest(url: url!))
Upvotes: 0
Views: 8709
Reputation: 1493
Apple doesn't allow plain HTTP requests anymore, as of WWDC 2015. However you can disable this restriction. You will need to add this to your Info.plist
file:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>
(To open the file as source code, just right-click it and choose "Open As")
Upvotes: 5