I have a button in my app which allows the user to delete all the cookies and cache. For some reason it doesn't delete all the cookies. For example when users are logged into facebook after a cookie delete action and a refresh, they are still logged in.
So the question is, what is wrong with this code? Or what should I do to guarantee all cookies are really deleted?
// Delete Cookies
func deleteCookies() {
if let cookies = HTTPCookieStorage.shared.cookies {
for cookie in cookies {
HTTPCookieStorage.shared.deleteCookie(cookie)
}
}
}
// Delete Cache
func deleteCache() {
URLCache.shared.removeAllCachedResponses()
URLCache.shared.diskCapacity = 0
URLCache.shared.memoryCapacity = 0
}