0
votes

I have an ImageDownloader class with NSURLConnection* connection as an ivar which initializes it setting its delegate as self. Now the doubt is when I init an ImageDownloader instance in my AsyncImageView so that my image downloading is started it has a retain count =2 {1 with image downloader init and 2 with nsurl init setting delegate as self}. So when i release image downloader from my asyncImageView it still has a retain count =1.

How do I release the imageDownloader instance because there is probably a leak? If I release connection ivar in imageDownloader the retain count should be 0 but then the app crashes(for obv. reasons).

1
post the debugger crash function call trace and your code.SayeedHussain

1 Answers

0
votes

Yes, NSURLConnection instance retains its delegate. So you should call [connection cancel] to release it before releasing ImageDownloader instance.