Hola estoy teniendo problemas con una fuga de UIWebView básicamente tengo mis páginas de visualización WebView con los enlaces en una UITableView de otro controlador. Empujo el controlador con WebView con un navegador y paso el enlace con un retenerle propiedad.IOS UIWebView Fuga
He intentado todo en Internet, como:
[[NSUserDefaults standardUserDefaults] setInteger:0 forKey:@"WebKitCacheModelPreferenceKey"];
//Clear cache of UIWebView
NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
[NSURLCache setSharedURLCache:sharedCache];
[sharedCache release];
sharedCache = nil;
[[NSURLCache sharedURLCache] removeAllCachedResponses];
este es mi código:
-(void) viewWillAppear:(BOOL) animated
{
NSMutableURLRequest *_req=[[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:link] cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:120];
[_req setHTTPShouldHandleCookies:NO];
[self setMyRequest:_req];
[req release];
}
[webView loadRequest:myRequest];
-(void) viewWillDisappear:(BOOL) Animated
{
[webView stopLoading];
[webView loadHTMLString:@"<html></html>" baseURL:nil];
}
- (void)dealloc {
[myRequest release];
[webView stopLoading];
[webView release];
[link release];
[super dealloc];
}
Ahora solo probé en el simulador 4.2 y 4.3, uso xcode 4, obtengo estas fugas cuando presiono el botón Atrás en el navegador.
Y aquí es el código de mi controlador tableview
- (void)viewDidLoad {
webViewController=[[ItemDetail alloc] initWithNibName:@"ItemDetail" bundle:[NSBundle mainBundle] ];
[super viewDidLoad];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
webViewController.link=http://www.myLink.com;
[self.navigationController pushViewController:webViewController animated:YES];
}
-(void) dealloc
{
[webViewController release];
...
...
[super dealloc];
}
Aquí hay un enlace a una pantalla: http://postimage.org/image/368r0g0xw/
Cualquier ayuda se agradece, Gracias
Una de sus líneas de código aparece fuera de cualquier método, ¿puede publicar su código real? Eso no compilará ¿Dónde se asigna/asigna 'myRequest'? ¿Qué pasa con 'link'? ¿Has configurado un delegado para el 'UIWebView'? – Jim
lo siento, seguro que voy a publicar el código ahora –