'Is webViewWebContentProcessDidTerminate ever called for an app running in the background?
If a WKWebView terminates when an app is running in the foreground, webViewWebContentProcessDidTerminate will be called on its delegate.
But what happens if the app is in the background?
Will it still receive the callback immediately? Will it receive it when the app is later foregrounded? Does it not run at all?
I currently don't know how to trigger a termination – otherwise I would just try it.
I ask because I want to make it reload the web view that was terminated to avoid a blank screen in my app, but I'm not sure if this will actually work with an app running in the background.
Solution 1:[1]
For me WKWebView terminates only if my app is in the background and iOS lacks memory for other apps terminating the WKWebView in my app. If you open the app again, WKWebView is broken and webViewWebContentProcessDidTerminateis called.
Try to reproduce as @joemasilotti pointed:
- Open your app with a WKWebView active
- Move your app in the background - don't terminate it!
- Open a lot of other apps to use memory or maybe play a graphic intense game for a view seconds.
- Try to open your app again and you should see a blank/grey screen.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Fa11enAngel |
