开发者

Will an image or document be cached when it is viewed through UIWebView in iOS?

开发者 https://www.devze.com 2023-04-08 10:20 出处:网络
Typically when we load a image or document through a browser, the image gets cached in a temp folder. Is this the same case for Mobile safari and other browsers in MObil开发者_开发技巧e?

Typically when we load a image or document through a browser, the image gets cached in a temp folder. Is this the same case for Mobile safari and other browsers in MObil开发者_开发技巧e?

And if that is the case, if the phone is rooted, will user be able to access them? Will an image or document be cached when it is viewed through UIWebView in iOS?


No, the class doing the caching is NSURLRequest. You can remove the cache for a particular request

[[NSURLCache sharedURLCache] removeCachedResponseForRequest:request];

or for all of them

[[NSURLCache sharedURLCache] removeAllCachedResponses];

or set an empty cache before performing any request

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

精彩评论

暂无评论...
验证码 换一张
取 消