UIViewController is popped from view stack and NSURLConnection crashes the application

Posted by rickharrison on Stack Overflow See other posts from Stack Overflow or by rickharrison
Published on 2010-05-23T17:59:30Z Indexed on 2010/05/23 18:10 UTC
Read the original article Hit count: 245

I am pushing a UIViewController onto a UINavigationController. This view controller immediately starts a download of an xml feed and then parses it. However, if you hit the back button before it is done downloading, and crashes with EXC_BAD_ACCESS. The line that is crashing it is in parserDidEndDocument and is this line:

if (self.delegate && [self.delegate conformsToProtocol:@protocol(ModelDelegate)]) [self.delegate modelDidFinishParsing:self];

I assume it is crashing because it is trying to access self.delegate which is not assigned anymore. How do I get around this?

Also, I would release the model object in the modelDidFinishParsing method. How would I release this model if it never reaches this method.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiviewcontroller