Reputation: 2997
I use a UIWebView to connect my app to the gmail web view... if I close the the viewController.. after a short time I get this error :
[MailViewController respondsToSelector:]: message sent to deallocated instance 0x142c8c00
I also try to use the method:
- (IBAction)close:(id)sender{
[web stopLoading];
[self dismissModalViewControllerAnimated:YES];
}
without any success... how can I fix my problem?
Upvotes: 0
Views: 139
Reputation: 32681
You probably forgot to set the UIWebView
's delegate
to nil
in the dealloc
method of your MainViewController
.
Thus the webview send some message to its delegate (the MainViewController
) after it has been deallocated, explaining the crash.
From the -[UIWebView delegate]
method documentation:
Important: Before releasing an instance of
UIWebView
for which you have set a delegate, you must first set its delegate property tonil
. This can be done, for example, in your dealloc method.
Upvotes: 2