UIWebView and NSUrlCache

I have an NSURLCache that just logs the calls to cachedResponseForRequest and storeCachedResponse.

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

Is there a reason why this can happen (not)?

I watch this on the simulator and ipad 3.2 device.

+3
source share
1 answer

As I understand it, WebKit uses a private mechanism for storing and storing assets in the cache. These are the above methods:

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

Note that they use Core Foundation objects.

+3

Source: https://habr.com/ru/post/1752923/


All Articles