httpcookiestorage.shared()和wkwebsitedatastore.default()共享cookie吗?

发布于 2025-02-09 04:24:34 字数 675 浏览 3 评论 0原文

我的应用中有一个Web视图,其cookie自动存储在wkwebsitedatastore.default()中。当我注销时,我会使用以下方式删除这些cookie:

[[WKWebsiteDataStore defaultDataStore] fetchDataRecordsOfTypes:WKWebsiteDataStore.allWebsiteDataTypes completionHandler:^(NSArray<WKWebsiteDataRecord *> * _Nonnull records) {
    [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:WKWebsiteDataStore.allWebsiteDataTypes forDataRecords:records completionHandler:^{}];
}];

但是,当我再次登录时,wkwebsitedatastore具有相同的旧cookie。通过迭代,我检查了这些cookie是否存储在httpcookiestorage.shared中,wkwebsitedatastore可能会使用它们。

我想知道这两个之间的依赖性是什么。我应该在Wkwebsitedatastore和Httpcookiestorage中清除cookie吗?

I have a web view in my app whose cookies are stored automatically in WKWebsiteDataStore.default(). When I logout I delete these cookies using :

[[WKWebsiteDataStore defaultDataStore] fetchDataRecordsOfTypes:WKWebsiteDataStore.allWebsiteDataTypes completionHandler:^(NSArray<WKWebsiteDataRecord *> * _Nonnull records) {
    [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:WKWebsiteDataStore.allWebsiteDataTypes forDataRecords:records completionHandler:^{}];
}];

But when I login again the WKWebsiteDataStore is having same old cookies. Through iteration I checked that these cookies are stored in HTTPCookieStorage.shared also and WKWebsiteDataStore probably uses them.

I want to know what's the dependency between these two. Should I clear cookies in both WKWebsiteDataStore and HTTPCookieStorage?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文