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?