I\'m developing an iOS app that will show some 360 panoramic content in a wkWebView. The page does load, but when it receives a memory warning, it shows a blank view on iPad 2.
One major cause of this is the WebContent process crashing.
In iOS 9 and above you can use the WKNavigationDelegate method webViewWebContentProcessDidTerminate
to catch this case. It's up to you to decide how to respond to the crash, but if reloading the page is enough, then [webView reload]
will do the trick as shown below. As @ray mentions in the comments, you will not get any useful information about the why of the crash from this delegate call.
- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView {
// Reload current page, since we have crashed the WebContent process
// (most likely due to memory pressure)
[webView reload];
}
In iOS8 and below, you can check if myWKWebViewInstance.title
is nil.