iOS--UIWebView清除缓存和Cookie

1.清除缓存和cookie

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

2.清除UIWebView的缓存

   [[NSURLCache sharedURLCache] removeAllCachedResponses];  
    NSURLCache * cache = [NSURLCache sharedURLCache];  
    [cache removeAllCachedResponses];  
    [cache setDiskCapacity:0];  
    [cache setMemoryCapacity:0];  
}  
阅读更多
版权声明:欢迎转载! https://blog.csdn.net/liuhaiyanga/article/details/52386448
文章标签: cookie 缓存 uiwebview
个人分类: UIWebView iOS
上一篇iOS--js和oc交互
下一篇Http和Https的区别
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭