I'm using a UIWebView in an iOS application and it won't stop loading in old assets. My index.html references multiple javascript files that don't seem to update unless I clean the build folder, and even then they can sometimes persist. I can remove the folder with the html, css and javascript from the project, delete it and still build and run with it displaying in the web view.
My AppDelegate clears the cache with
[[NSURLCache sharedURLCache] removeAllCachedResponses];
[[NSURLCache sharedURLCache] setDiskCapacity:0];
[[NSURLCache sharedURLCache] setMemoryCapacity:0];
after 'didFinishLaunchingWithOptions'. I then add the files to the web view with:
NSURL *mainBundleURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]];
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
NSString *htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
[_webView loadHTMLString:htmlString baseURL:mainBundleURL];
I have also tried loading the files with a request, but I get the same results.
NSURL *url = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html"];
NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:0 timeoutInterval:60.0];
[self.webView loadRequest:request];
I have tried adding the folder as a folder reference and group reference in the project. The folder can be found in the Copy Bundle Resources. I've started over with creating a new project, but the problem was still there.
It seems like such a simple issue, but I've tried everything I can find online.