首页 > 代码库 > iOS UIWebView清除缓存

iOS UIWebView清除缓存

UIWebView清除Cookie:

//清除cookiesNSHTTPCookie *cookie;NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];for (cookie in [storage cookies]) {    [storage deleteCookie:cookie];}

UIWebView清除缓存:

//清除UIWebView的缓存[[NSURLCache sharedURLCache] removeAllCachedResponses];

//清除缓存(全)
NSURLCache * cache = [NSURLCache sharedURLCache];  
[cache removeAllCachedResponses];  
[cache setDiskCapacity:0];  
[cache setMemoryCapacity:0];

iOS UIWebView清除缓存