Question

I have a NSURLCache that simply logs cachedResponseForRequest and storeCachedResponse calls.

It seems that UIWebView will call cachedResponseForRequest for every request, but storeCachedResponse will only be called for the top-level page, i.e. not for any css/js/etc. specified in the html.

Is there any reason why this might be (not) happening?

I'm observing this on 3.2 ipad simulator and device.

Was it helpful?

Solution

As far as I understand, the WebKit is using a private mechanism to get and store assets in cache. These are the aforementioned methods:

- (CFCachedURLResponse*)_nscfBridgeURLCacheCopyResponseForRequest:(CFURLRequest*)request;
- (void)_nscfBridgeURLCacheStoreCachedResponse:(CFCachedURLResponse*)cachedResponse forRequest:(CFURLRequest*)request;

Note that they're using Core Foundation objects.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top