我想加载没有缓存的webview?
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Request Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[kdgWebView loadRequest:requestObj];
Run Code Online (Sandbox Code Playgroud)
Lui*_*oza 38
Objective-C的:
// Remove and disable all URL Cache, but doesn't seem to affect the memory
[[NSURLCache sharedURLCache] removeAllCachedResponses];
[[NSURLCache sharedURLCache] setDiskCapacity:0];
[[NSURLCache sharedURLCache] setMemoryCapacity:0];
Run Code Online (Sandbox Code Playgroud)
您可以在http://blog.techno-barje.fr/post/2010/10/04/UIWebView-secrets-part2-leaks-on-release/中找到更多信息.
迅速:
URLCache.shared.removeAllCachedResponses()
URLCache.shared.diskCapacity = 0
URLCache.shared.memoryCapacity = 0
Run Code Online (Sandbox Code Playgroud)
Lui*_*oza 14
您可以使用以下代码更改缓存策略:
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url
cachePolicy:NSURLRequestReloadIgnoringCacheData
timeoutInterval: 10.0];
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
31089 次 |
最近记录: |