1

i can't open all pages in my project, for example:

let url = NSURL (string: "http://www.dreambox.com");
    let requestObj = NSURLRequest(url: url! as URL);
    self.myWebView.mainFrame.load(requestObj as URLRequest!);

But i can open sites like google and wikipedia

let url = NSURL (string: "https://www.google.com");
    let requestObj = NSURLRequest(url: url! as URL);
    self.myWebView.mainFrame.load(requestObj as URLRequest!);
Dan Herau
  • 11
  • 1
  • This could be the case because Apple requires HTTPS to be used. You can however add exceptions for unencrypted sites. See [this question](http://stackoverflow.com/questions/30731785/how-do-i-load-an-http-url-with-app-transport-security-enabled-in-ios-9) – Palle Mar 26 '17 at 22:31

2 Answers2

2

Add this code to your Info.plist

<key>NSAppTransportSecurity</key>
<dict><key>NSAllowsArbitraryLoads</key>
  <true/></dict>
Jonh Blake
  • 31
  • 1
0

Let add these keys into the Info.plist

enter image description here

Danh Huynh
  • 2,337
  • 1
  • 15
  • 18