I really think that it can save cached information when you close UIWebView . I tried removing the UIWebView from my UIViewController by releasing it and then creating a new one. The new one remembered where I was when I returned to the address without restarting everything (he remembered that my previous UIWebView was registered).
So a few suggestions:
[[NSURLCache sharedURLCache] removeCachedResponseForRequest:NSURLRequest];
This will remove the cached response for a particular request. There is also a call that will delete all cached responses for all requests running on the UIWebView :
[[NSURLCache sharedURLCache] removeAllCachedResponses];
After that, you can try to delete all related cookies using UIWebView :
for(NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) { if([[cookie domain] isEqualToString:someNSStringUrlDomain]) { [[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie]; } }
Swift 3:
// Remove all cache URLCache.shared.removeAllCachedResponses() // Delete any associated cookies if let cookies = HTTPCookieStorage.shared.cookies { for cookie in cookies { HTTPCookieStorage.shared.deleteCookie(cookie) } }
groomsy Apr 09 2018-11-11T00: 00Z
source share