haifengkao / YWebView

WKWebview with persistent cookies support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clear previous cookies before of adding the new ones

asam139 opened this issue · comments

it would be perfect that the webview cleans the previous cookies stored in the storage if not I need to create each time the webview to clean them.

NSSet *websiteDataTypes = [NSSet setWithArray:@[WKWebsiteDataTypeCookies]];
NSDate *dateFrom = [NSDate dateWithTimeIntervalSince1970:0];
[_wkWebView.configuration.websiteDataStore removeDataOfTypes:websiteDataTypes
                                                                                         modifiedSince:dateFrom
                                                                                 completionHandler:^{}];

sure. please send me a PR. I think it should be a public method.