I call removeAllCachedResponses before loading the new index.html. The page does appear to reload but we have files that load files and files that get injected into divs. The updated files are not injected. The old cached version is used instead.
NSString *reloadTarget = [docDir stringByAppendingPathComponent:[ NSString stringWithFormat:@"/index.html"]]; [[NSURLCache sharedURLCache] removeAllCachedResponses]; [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:reloadTarget]]]; On Thu, Apr 25, 2013 at 3:57 PM, Shazron <shaz...@gmail.com> wrote: > We set up a cache in AppDelegate.m[1], and I suppose you could hook into > CDVPageDidLoadNotification[2] in your own plugin, then clear the cache[3]: > > e.g. > [[NSURLCache sharedURLCache] removeAllCachedResponses] > > > [1] > > https://github.com/apache/cordova-ios/blob/c6e71147386d4ad94b07428952d1aae0a9cbf3f5/bin/templates/project/__TESTING__/Classes/AppDelegate.m#L46-L53 > [2] > > https://github.com/apache/cordova-ios/blob/9facafb4f96c7f81097a9424505398821589ba54/CordovaLib/Classes/CDVPlugin.h#L26 > [3] > > https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSURLCache_Class/Reference/Reference.html > > > > On Thu, Apr 25, 2013 at 11:46 AM, David Lewis <lewi...@gmail.com> wrote: > > > I've got a Cordova 2.6 app on iOS 6 that uses ~/Documents as the webroot > > for updating purposes. Because of the JS load, when the index.html is > > reloaded after it is changed (delete and copy from the update), not > > everything is loaded again. > > > > I don't have the details for it, but there is a display parameter that > > should change when the new page is loaded. So far, the only way to > achieve > > this is through resetting the entire app through user intervention. > > > > I've seen reference to iOS Safari caching POST, which we are certainly > > using, but the data in question is generated from local files. > > > > Is there a way to reset the cache when the index.html is reloaded? > > > > Thanks, > > > > David > > >