I run into a dead end. I just can\'t figure out a way for restoring a WKWebView after the user has closed the app. All the web pages he visited must be there when he re-open
you can store webpages in [NSDefaults standardUserDefaults] whenever the WKWebView
has loaded.
- (void)webView:(WKWebView *)webView didFinishNavigation: (WKNavigation *)navigation{
}
All the web pages he visited must be there when he re-opens it
Impossible. The history of web pages visited - the backForwardList
, and all its contents - is read-only. Nor is it saved and restored for you when you participate in view controller state saving and restoration.
In my opinion, this is a major flaw in WKWebView.
If you need this feature, revert to UIWebView, where it's all done for you like magic if you participate in view controller state saving and restoration.