WKWebView goBack() issue

Since iOS 13.4 (or 13.4.1) we have started seeing an issue in our hybrid app where if the user is on a slow network and they tap back before all resources have finished loading (by this i mean the page itself has finished loading but other assets and JS files have not finished loading) then an error is thrown:

Code Block
Error Domain=NSURLErrorDomain Code=-999 "(null)" UserInfo={NSErrorFailingURLStringKey=https://www.website.com, NSErrorFailingURLKey=https://www.website.com, _WKRecoveryAttempterErrorKey=<WKReloadFrameErrorRecoveryAttempter: 0x2839b46a0>}

sometimes, it's thrown twice. if the page in the error is the one the user is navigating away from, then the page they are going back to will continue to load. However if the single error, or the second error (if two are thrown) contain the page begin returned to, loading stops and the page never refreshes.

Im at loss to explain this and the only solution coming to mind is to retry if the page is not loading, though im not keen on this.

It doesn't seem to happen on versions lower than 13.4

Thanks

To further Clarify this. If you tap back while the page you are on is still loading (the html can be fully loaded but additional resources are still coming down) the you get this error. this is a "Cancelled" error, which is ok, and the web view reports that it is still loading the page you are returning to.

However, if the page you are returning to wasn't fully loaded when you moved on, then the error is thrown again and the web view stops loading.

in this situation, within

Code Block
func webView(_ webView: SDWebView, didFail navigation: WKNavigation!, withError error: Error)


if the webview is not loading and a .reload() is called, the page will load.

This behaviour has only started happening since iOS 13.4


WKWebView goBack() issue
 
 
Q