UIWebView中的本地HTMLcaching策略

我已经通过各种解决scheme,以清除UIWebView中的本地图像caching,而我试图在HTML中加载图像primefaces显示以前的图像(我使用相同的名称来replace模板中的图像)。

[[NSURLCache sharedURLCache] removeAllCachedResponses]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL:[NSURL fileURLWithPath:[[CustomFunctions getFilesPath] stringByAppendingPathComponent:obj]] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:30.0]; [webview1 loadRequest:request]; [webview1 reload]; 

这是我的代码,可以任何人请build议我这样做。 提前致谢。 对不起我的英语不好。

//防止应用程序内部caching网页

 NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil]; [NSURLCache setSharedURLCache:sharedCache]; //[sharedCache release]; sharedCache = nil; 

尝试使用这个。 它将清除您的应用程序的URLcaching内存。

尝试这个 …

 [[NSURLCache sharedURLCache] removeCachedResponseForRequest:NSURLRequest]; 

这将为特定请求移除caching的响应。 还有一个调用会移除在UIWebView上运行的所有请求的caching响应:

 [[NSURLCache sharedURLCache] removeAllCachedResponses];