codemonkey
codemonkey

Reputation: 2665

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 concerned about, or does the iPhone OS handle this for me?

Upvotes: 2

Views: 347

Answers (2)

tc.
tc.

Reputation: 33592

Additionally, have your view controller un-set itself as the delegate for pending HTTP requests in dealloc.

Upvotes: 1

Matt Williamson
Matt Williamson

Reputation: 40203

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.

Upvotes: 2

Related Questions