关闭

IOS 清除UIWebView的缓存

标签: iPhoneUIWebView缓存
6994人阅读 评论(0) 收藏 举报


[[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];
    }
}
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:161636次
    • 积分:2349
    • 等级:
    • 排名:第15930名
    • 原创:83篇
    • 转载:24篇
    • 译文:1篇
    • 评论:1条
    文章分类
    最新评论