How to clear UIWebview Cache for local images and Video files

Hello All,

I have used a UIWebView to load a html which i have downloaded from server and stored in the documents directory, and there is a PNG and video file inside the html


After that i have updated the png and video file and downloaded the content and stored in the documents directory with the same name.

After the PNG and video file modified, I reload the html in UIWebView, but the image doesn't change. However, if I quit the app and reopen it, the image and video file will be changed to the new one.


I have checked the PNG file in Documents with Finder, so I'm sure it has been modified, but the old one is still in UIWebView.


I have tried to clear NSURLCache with following lines of code

[[NSURLCache sharedURLCache] removeAllCachedResponses];

[[NSURLCache sharedURLCache] setDiskCapacity:0];

[[NSURLCache sharedURLCache] setMemoryCapacity:0];

I have also set CachePolicy NSURLRequestReloadIgnoringLocalAndRemoteCacheData

but no success.

How do I clear the UIWebView cache when using a media files inside a html?


Thanks,

Akshay

Hi,


I've had the same problem for like 3 years (not only for images but also, JS, CSS etc.). Very annoying.

Did you find a solution ?

Can someone from Apple help ?


Thanks,


Julien

How to clear UIWebview Cache for local images and Video files
 
 
Q