UIWebView 中发生错误



Web 视图加载失败,出现以下错误

Domain=WebKitErrorDomain Code=102 "Frame load interrupted" UserInfo={NSErrorFailingURLStringKey=file://www..com, NSLocalizedDescription=Frame load interrupted, NSErrorFailingURLKey=file://www.website.com}

我的代码:

   webView.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: self.view.frame.size.height)
    webView.delegate = self
    let url = NSURL(string: "www.amazon.com")
    let request = NSURLRequest(url: url as! URL)
    webView.loadRequest(request as URLRequest)
    view.addSubview(webView)
 func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool {

    return true
}
func webViewDidStartLoad(_ webView: UIWebView) {
    print("webview is start loading")
}
func webViewDidFinishLoad(_ webView: UIWebView) {
    print("webview is finish loading")
}
func webView(_ webView: UIWebView, didFailLoadWithError error: Error) {
    print("webview loading error(error)")
}

我认为你应该使用"http://www.amazon.com"或"https://www.amazon.com"

相关内容

  • 没有找到相关文章

最新更新