Tengo una aplicación de iPhone que muestra un sitio web. Este sitio web cambia su contenido de vez en cuando, pero mi aplicación no lo vuelve a cargar cada vez que se abre. Traté de evitar el almacenamiento en caché del sitio, pero sin éxito.iOS: Forzar UIWebView para volver a cargar/evitar el almacenamiento en caché
Este es mi método init:
- (id)init:(NSString *)url withTitle:(NSString *)theTitle withPageName:(NSString *)pageName {
self = [super init];
if(self) {
NSLog(@"websiteviewcontroller init");
self.title = theTitle;
self.url = url;
self.pageName = pageName;
CGRect frame = [[UIScreen mainScreen] applicationFrame];
webView = [[UIWebView alloc] initWithFrame:frame];
NSURL *theURL = [NSURL URLWithString:url];
[webView loadRequest:[NSURLRequest requestWithURL:theURL]];
// support zooming
webView.scalesPageToFit = YES;
//[[NSURLCache sharedURLCache] removeAllCachedResponses];
[webView reload];
}
return self;
}
Ésta es mi viewWillAppear-Método:
- (void)viewWillAppear:(BOOL)animated {
CGRect frame = [[UIScreen mainScreen] applicationFrame];
webView = [[UIWebView alloc] initWithFrame:frame];
NSURL *theURL = [NSURL URLWithString:url];
[webView loadRequest:[NSURLRequest requestWithURL:theURL]];
[webView reload];
// support zooming
webView.scalesPageToFit = YES;
}
favor me ayuda a resolver este problema. Todas las respuestas son muy apreciadas.