1

I am using a UIWebview and load a NSMutableURLRequest into it:

NSMutableURLRequest* req = [NSMutableURLRequest requestWithURL:initialURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:10.0];
[_webview loadRequest:req];

This requests get loaded when inside another UIWebview (a kind of startpage) a link is clicked.

When looking into the network traffic with WireShark initially 150 requests are captured. Navigating back to the startpage and open the link again should then report 150 requests again, but it doesn't. Only about 100 requests are captured. The ones missing are some CSS files, PNGs, Fonts, JSON and XML.

After closing the whole application 150 requests are captured, as expected. It seems like the UIWebView itself is caching some data and ignores the set cache policy.

Is there any way to force the UIWebView loading the resources according to their policy?

ilmgb
  • 780
  • 4
  • 20
  • Did you solve this? I'm stuck with the same problem. – Niklas Berglund Oct 01 '13 at 10:57
  • 1
    No. Had no success. My last words in the documentation were: "The Caching App cannot be implemented in a 100% Filesystem cache, as the UIWebView caching behavior is not consistent. We would need a caching policy that is set to NSURLRequestIgnoringLocalCacheData, but this seems to bypass some of the request with an own, uncontrollable cache." – ilmgb Jan 27 '14 at 08:05
  • agreed. Same here. I created a related question http://stackoverflow.com/questions/19113682/remove-uiwebviews-internal-cache and also came to the conclusion that it's not possible. My workaround was to ask the user to restart the application when content had been updated, and needed to be reloaded. – Niklas Berglund Jan 27 '14 at 08:21

0 Answers0