NSURLConnection retains its delegate
NSURLConnection retains its delegate
- Subject: NSURLConnection retains its delegate
- From: Jonathan del Strother <email@hidden>
- Date: Thu, 10 Aug 2006 17:30:13 +0100
I ran into an odd problem recently where my objects that I created to
receive a response from an NSURLConnection were never getting
released. After several hours of debugging, I finally discovered
that NSURLConnection seems to retain its delegate.
BBConnectionHandler* connectionHandler = [[BBConnectionHandler alloc]
init]; //connectionHandler has a retain count of 1
NSURLConnection* connection = [NSURLConnection
connectionWithRequest:request delegate:connectionHandler];
//connectionHandler now has a retain count of 2.
...which all lead to a rather unpleasant retain cycle that was a pain
in the ass to unwind.
Surely this is wrong? I'm sure I remember reading somewhere that
objects should not retain their delegates for exactly the above
reason. This isn't standard behavior - shouldn't it at least be
documented?
Jon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden