I've got an app with UIWebView
which is used to load local files.
I've created a custom URL protocol, which I use to do some stuff with the data passed to the web view, and in startLoading I've added:
[self.client URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
Also when starting the app, I've disabled the cache using this piece of code:
NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
[NSURLCache setSharedURLCache:sharedCache];
sharedCache = nil;
but unfortunately, the damn thing still allows for caching local files.
When I close the web view and open it again, the javascript files are not loaded again through my url protocol.
What else should I set to make it work?
My goal is to always load files through the custom url protocol, and not only the first time.
For me, the startLoading
method in NSURLProtocol
is not called for subsequential requests.