IOS 清除UIWebView的缓存

来源:互联网 发布:北电网络 超级连接 编辑:程序博客网 时间:2024/06/08 11:25


[[NSURLCache sharedURLCache] removeCachedResponseForRequest:NSURLRequest];

This would remove a cached response for a specific request. There is also a call that will remove all cached responses for all requests ran on the UIWebView:

[[NSURLCache sharedURLCache] removeAllCachedResponses];

After that, you can try deleting any associated cookies with the UIWebView:

for(NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) {    if([[cookie domain] isEqualToString:someNSStringUrlDomain]) {        [[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];    }}
原创粉丝点击