ios simulator webview throws "Timeout has occurred"

531 Views Asked by At

I'm doing a simple mobile application which embeds a WkWebView to display my website using Ionic 6 + Angular.

I have tested my website with Chrome and Safari on Macbook, everything was fine until I opened it on my WKWebView control.

At first, my webview displayed successfully (as the below image)

enter image description here

When I clicked Submit button, my Ionic 6 website would call an API Endpoint & continued download some chunks and go to the next page.

However, this is what I got after Submit button has been clicked:

enter image description here

The error message was:

[Error] ERROR
Object

info: {meta: null, lastValue: null, seen: 0}

message: "Timeout has occurred"

name: "TimeoutError"

stack: "@http://****/main.02dd4c6bece51f6f.js:1:175858↵@http://****/main.02dd4c6bece51f6f.js:1:43982…"


This is how I setup my webview:

 func setupWebView() {
        let url = URL(string: "http://<my-end-point>/")!
        let request: URLRequest = URLRequest(url: url, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 180)
        webView.load(request)
    
        webView.allowsBackForwardNavigationGestures = true
        webView.configuration.userContentController.add(self, name: listenerName)
    }

My question is:

  • Can I increase the timeout of WKWebView to by pass this issue ?
  • I haven't deployed my app onto physical device, is it an issue of simulator only ? or it is physical device issue also ?
0

There are 0 best solutions below