gpt4 book ai didi

iphone - 没有缓存的 UIWebview

转载 作者:IT王子 更新时间:2023-10-29 08:04:47 26 4
gpt4 key购买 nike

我想加载一个没有缓存的 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];

最佳答案

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];

您可以在 http://blog.techno-barje.fr/post/2010/10/04/UIWebView-secrets-part2-leaks-on-release/ 中找到更多信息

swift :

URLCache.shared.removeAllCachedResponses()
URLCache.shared.diskCapacity = 0
URLCache.shared.memoryCapacity = 0

关于iphone - 没有缓存的 UIWebview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9744644/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com