I'm showing a web app in an UIWebView
, and sometimes the content of pages will change. After content have been changed the app clears the cache. But when I go to a page I've previously visited the UIWebView
doesn't send a HTTP GET request, but loads from cache even though I've disabled cache like so:
[[NSURLCache sharedURLCache] removeAllCachedResponses];
[[NSURLCache sharedURLCache] setDiskCapacity:0];
[[NSURLCache sharedURLCache] setMemoryCapacity:0];
Initally I'm loading a request with cachePolicy cachePolicy:NSURLRequestReturnCacheDataElseLoad
.
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:myURLString] cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:10.0]];
UIWebView
have some kind of internal cache. Already visited pages will be loaded from this internal cache instead of going through NSURLCache
and also there's no request sent.
Is there any way to clear the internal cache of UIWebView
? I'm even recreating the UIWebView
but the cache is still there.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…