I\'m experiencing crashes of an app that uses UIWebView. Usually it\'s when page is not fully loaded and UIWebView is sent stopLoading selector. Or when UIWebView fully load
You have to stop loading the webView and remove the delegate before leaving the view:
// ARC (correct solution)
- (void)dealloc {
[_webView setDelegate:nil];
[_webView stopLoading];
}
// non ARC
- (void)dealloc {
[webView setDelegate:nil];
[webView stopLoading];
[webView release];
[super dealloc];
}
// ARC (older solution)
- (void)viewWillUnload {
[webView setDelegate:nil];
[webView stopLoading];
}
What Apple documentation is saying: Important Before releasing an instance of UIWebView for which you have set a delegate, you must first set its delegate property to nil. This can be done, for example, in your dealloc method.