NSURLConnection shown as leaking in instruments

Posted by Gyozo Kudor on Stack Overflow See other posts from Stack Overflow or by Gyozo Kudor
Published on 2010-06-18T07:42:37Z Indexed on 2010/06/18 8:23 UTC
Read the original article Hit count: 243

Hello another stupid question regarding leaks and also NSURLConnection. How do i release it? Is it enough if i release in the following 2 methods?

(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
(void)connectionDidFinishLoading:(NSURLConnection *)connection

Because in instruments it shows me the line where I alloc my connection as the source of leaking.

OK I don't get it. After the following code my urlConnection has a retain count of 2. WTF?

NSURLConnection *urlConnection = [[NSURLConnection alloc] initWithRequest: urlRequest delegate: self];

This is the line that instruments points me to. I find this very weird.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c