-2

I am trying to create a UIWebView but it would not load.

I just get empty frame

func webViewDidStartLoad(webView: UIWebView) {
    // Do any additional setup after loading the view, typically from a nib.
    let url = NSURL (string: "http://www.sourcefreeze.com");
    let requestObj = NSURLRequest(URL: url!);
    webview.loadRequest(requestObj);
}
rmaddy
  • 314,917
  • 42
  • 532
  • 579
system21
  • 361
  • 4
  • 16

1 Answers1

0

Need more information of your question, just a guest, you are running on iOS 9, and your url is http, because of the security enhancement of iOS 9, by default, only https request is allowed, so if you want to make http request, you need to add some configuration in your info.plist file.

Either to add white list or allow all http request:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>

put this inside your info.plist

ian
  • 106
  • 5