How to correctly use NSURLConnection ?

Discussion in 'iOS Programming' started by namanhams, Mar 3, 2011.

  1. namanhams macrumors regular

    Joined:
    Jun 3, 2009
    #1
    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 ?
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
  3. namanhams thread starter macrumors regular

    Joined:
    Jun 3, 2009
    #3
    But that property is not public :confused:
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    Sorry: my mistake. The documentation suggests the behaviour you are seeing should not happen.

    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.
     

Share This Page