I am working on an iOS application that displays locally stored content (HTML files) in a UIWebView.
The problem is that some of the resources referenced by HTML files (such as fonts and images) are loaded for the first time. I assume the solution to the problem is to somehow cache these resources using NSURLCache before they are used in UIWebView, but this seems to cause some problems.
What I have tried so far:
Subclassing NSURLCache and overriding cachedResponseForRequest so that it returns a response with the resource preloaded into the NSData object. Preloading is done in the init method. cachedResponseForRequest seems called, but for some reason UIWebView is still loading the asset from the file system.
Using storeCachedResponse:forRequest: to cache NSCachedURLResponse objects containing assets before using them in a UIWebView.
None of them help. Any tips for finding a problem?
source share