Avoiding EXC_BAD_ACCESS when using the delegate pattern
A have a view controller, and it creates a "downloader" object, which has a reference to the view controller (as a delegate). The downloader calls back the view controller if it successfully downloads the item. This works fine as long as you stay on the view, but if you navigate away before the download is complete I get EXC_BAD_ACCESS . I understand why this is happening, but is there any way to check if an object is still allocated? I tried to test using delegate != nil , and [delegate respondsToSelector:] , but it chokes. if (!self.delegate || ![self.delegate respondsToSelector:@selector