在这里,我使用
在 uiwebview 中加载了内容[webView loadHTMLString:[theApp.contentArr objectAtIndex:spineIndex] baseURL:url];
回去之后需要清空缓存
我在这里尝试了这些清除缓存的方法:
[webView stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML = \"\";"];
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]];
// remove all cached responses
[[NSURLCache sharedURLCache] removeAllCachedResponses];
// set an empty cache
NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
[NSURLCache setSharedURLCache:sharedCache];
但是没有用,有什么办法解决这个问题.....
最佳答案
简单的方法:
NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
[NSURLCache setSharedURLCache:sharedCache];
关于objective-c - 如何清除ipad中的webview缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10686748/