3

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-opens it.

Any suggestions?

Vulkan
  • 1,004
  • 16
  • 44

2 Answers2

3

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.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • And file a bug report with Apple! – matt Sep 06 '15 at 16:58
  • @PeterLapisu No, my bug report is still just sitting there... If this is important to you, file your own bug report. Apple responds to quantity. – matt Feb 28 '20 at 17:57
1

you can store webpages in [NSDefaults standardUserDefaults] whenever the WKWebView has loaded.

- (void)webView:(WKWebView *)webView didFinishNavigation: (WKNavigation *)navigation{

}
krisrak
  • 12,882
  • 3
  • 32
  • 46
  • 1
    @user3737190, it sounds to me that you want someone to type simple search requests into the browser for you. And what is "an NSData background" ? – coco Feb 03 '15 at 17:17