haifengkao / YWebView

WKWebview with persistent cookies support
MIT License
104 stars 26 forks source link

Clear previous cookies before of adding the new ones #18

Open asam139 opened 4 years ago

asam139 commented 4 years ago

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:^{}];
haifengkao commented 4 years ago

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