Closed dqueffeulouatw closed 9 years ago
I am also seeing this issue with UIWebView not calling storeCachedResponse all the time but is calling cachedResponseForRequest
Don't usw AFURLCache, instead register AFHTTPURLProtocol for http requests:
[NSURLProtocol registerClass:[AFHTTPURLProtocol class]];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.apple.com/"]];
[self.webView loadRequest:request];
Actually this is not an AFCache issue, more a discussion about a problem with NSURLCache at least with UIWebView.
It seems like NSURLCache always calls cachedResponseForRequest: but not always storeCachedResponse:forRequest:.
I have a page with some images from the same directory and with the same cache headers, and some are cached but not all because storeCachedResponse:forRequest: is not called.
Sometimes if I navigate thru the pages and come back to the first, it is called.
So it may be difficult to cache a page with a single shot. We can't be sure all the resources is in the cache.