WKWebsiteDataStore.default() 对比 webView.configuration.websiteDataStore

WKWebsiteDataStore.default() vs webView.configuration.websiteDataStore

WKWebsiteDataStore.DefaultDataStore 和 webview 配置实例中的 Configuration.WebsiteDataStore 有什么区别?

如果我通过访问默认网站数据存储从 HttpCookieStore 中删除特定 cookie,当 webview 加载时,它会与 Configuration.WebsiteDataStore 中存在的 HttpCookieStore 同步吗?

除非您将 WKWebsiteDataStore.nonPersistent()(每次都是新的)dataStore 传递给您的 webview 配置,否则它将已经在其中包含 default(共享且始终相同)。

您可以通过 运行

自行检查
webview.configuration.websiteDataStore == WKWebsiteDataStore.default()

它将 return 为真。

所以一切肯定是同步的,因为它们是同一个实例。