PDA

View Full Version : UIWebView EXEC_BAD_ACCESS crash




sleaver
Mar 30, 2011, 02:26 PM
Hi

To start with I have a view hierarchy as follows in a navigation controller:

ContainerView
---- SubContainerView
-------- UIWebView (for this case)

If I start loading a URL in the UIWebView but then navigate back in the navigation controller I get a EXEC_BAD_ACCESS on the following line in main.m:

int retVal = UIApplicationMain(argc, argv, nil, nil);

I read that its because of the order of delegate being released so I added the following code in my view controller as I have a property for the webview and load it into the subContainerView:

- (void)viewDidDisappear:(BOOL)animated {
[externalView stopLoading];
externalView.delegate = nil;
[externalView release];
}

However it still crashed so I added zombies and get the following:

[DriversDetailViewController_iPad respondsToSelector:]: message sent to deallocated instance 0x663b520

Any ideas because I've run out of then?

Edit - I'm using Xcode 4 and having trouble finding anything so if I need anything please point me in the right direction!



RonC
Mar 30, 2011, 07:00 PM
I read that its because of the order of delegate being released so I added the following code in my view controller as I have a property for the webview and load it into the subContainerView:

...

Any ideas because I've run out of then?

How is the property set up? Does something retain that delegate? If not, should something be retaining it?

The message you're getting tells you that the object you're trying to send the message to (delegate) has been reclaimed by the garbage collector because it's reference count has fallen to 0.