清除UIWebView缓存

时间:2024-10-27 18:03:26
//清除cookies
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [storage cookies])
{
[storage deleteCookie:cookie];
}
//退出登录实现
//清除UIWebView的缓存
[[NSURLCachesharedURLCache] removeAllCachedResponses];

NSURLCache * cache = [NSURLCache sharedURLCache];

[cache removeAllCachedResponses];

[cache setDiskCapacity:0];

[cache setMemoryCapacity:0];