如何将 WKWebView 恢复到应用程序关闭之前的状态? [英] How can I restore a WKWebView to the state it was before the app closed?

查看:33
本文介绍了如何将 WKWebView 恢复到应用程序关闭之前的状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了死胡同.我只是想不出在用户关闭应用程序后恢复 WKWebView 的方法.当他重新打开它时,他访问过的所有网页都必须在那里.

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.

有什么建议吗?

推荐答案

当他重新打开它时,他访问过的所有网页都必须在那里

All the web pages he visited must be there when he re-opens it

不可能.访问过的网页的历史记录 - backForwardList 及其所有内容 - 是只读的.当你参与视图控制器状态保存和恢复时,它也不会为你保存和恢复.

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.

在我看来,这是 WKWebView 的一个主要缺陷.

In my opinion, this is a major flaw in WKWebView.

如果您需要此功能,请返回 UIWebView,如果您参与视图控制器状态的保存和恢复,一切都会为您完成.

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.

这篇关于如何将 WKWebView 恢复到应用程序关闭之前的状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆