UIWebView强制刷新

在开发中可能会遇到强制刷新WebView

本人已经测 程序退出再次进入的时候可以完全删除缓存(Memory和Disk上的缓存)

   [[NSURLCache sharedURLCache] removeAllCachedResponses];
    NSURLCache * cache = [NSURLCache sharedURLCache];
    [cache removeAllCachedResponses];
    [cache setDiskCapacity:0];
    [cache setMemoryCapacity:0];

清楚cookies

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

你可能感兴趣的:(UIWebView强制刷新)