How can I clear all cookies for few hosts in my webView? Method from this question not working.
I'm trying to work with vk.com oauth and it does not have user-logout method, so deleting cookis is one of existing ways to make other user possible to log in
Answer is below
I made it by
let cookieJar = NSHTTPCookieStorage.sharedHTTPCookieStorage()
for cookie in cookieJar.cookies! {
// print(cookie.name+"="+cookie.value)
cookieJar.deleteCookie(cookie)
}
Swift 4
func removeCookies(){
let cookieJar = HTTPCookieStorage.shared
for cookie in cookieJar.cookies! {
cookieJar.deleteCookie(cookie)
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With