Asynchronous Callbacks to Dismissed Viewcontrollers?
Have noticed issue while testing iphone app that if one quickly opens/dismisses a modal view which contains asynchronous http calls the app eventually freezes up with a EXC_BAD_ACCESS message. I'm relatively confident that there aren't any memory leaks in either the modal view or the viewcontroller that's launching it (at least none that I can find via the leak detection tool in xcode). My n00b mind wonders what happens with pending asynchronous callbacks when all of a sudden the view has been dismissed. Is this something I should be co开发者_Go百科ncerned about, or does the iPhone OS handle this for me?
You should retain the view controller in your HTTP request class or if you don't have an abstraction class, retain and release itself in the delegate methods.
Additionally, have your view controller un-set itself as the delegate for pending HTTP requests in dealloc.
精彩评论