Search code examples
swiftuiwebview

Swift 3 UIwebView dont load all URLS


I have a UIWebView in my swift 3 application and its works fine with my private site url, google url and some more urls.

but, when i try to enter this url

http://tzur-yitzhak.co.il/

i get white blank page without and error. i tried all night to understand why. The URL works fine on safari and chrome also

i use and gave permmission to HTTP in the Plist

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

this is my code (its works ok, exept this url)

let app_base_url_from_db = "http://tzur-yitzhak.co.il/?p=12333"
let url = NSURL(string: app_base_url_from_db)
        let requestObj = NSURLRequest(url: url! as URL)

        webview.loadRequest(requestObj as URLRequest)

can some body advice on this problem ?


Solution

  • use this code.

    let myURL = URL(string: "https://www.apple.com")
    let myRequest = URLRequest(url: myURL!)
    webview.load(myRequest)