httpcookiestorage.shared()和wkwebsitedatastore.default()共享cookie吗?
我的应用中有一个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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论