I’ve written a asynchronous call that has a completion block to return a UIImage, then in the completion block the view controller sets a UIImageView to use that image. My question is what happens if that view controller is popped off UINavigationController stack and is no longer alive before the completion block executes?
[MyAPI getImage:imageID completionBlock:^(MyAPIStatus status, id result) {
if (status == kSuccessful) {
self.ImageView.image = [UIImage imageWithData:result];
}
}];
Because the block passed to your API captures(retains)
self,selfwill be alive.So if you use retain/release properly or use ARC, this is harmless.