iOS How to correctly use NSURLConnection ?

namanhams

macrumors regular
Original poster
Jun 3, 2009
153
0
I've used NSURLConnection many times, and never got a problem. But i have a problem when i try to cancel it.
Basically, i create a NSURLConnection on the main thread with method :

Code:
connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
When an event happen (click on a button), i call
Code:
[connection cancel];
[connection release];
connection = nil;
However, it still call the delegate method.

From what i understand, it should not be like that.

Anyone know about this ?
 

robbieduncan

Moderator emeritus
Jul 24, 2002
24,597
60
Harrogate
But that property is not public :confused:
Sorry: my mistake. The documentation suggests the behaviour you are seeing should not happen.

Once this method is called, the receiver’s delegate will no longer receive any messages for this NSURLConnection.
Are you absolutely sure it's the same URL connection (i.e. you don't have multiple connections with the same delegate)? If so file a bug report with Apple.