Wednesday, May 1, 2013

NSURLConnection cancel example ios


Cancels an asynchronous load of a request.
- (void)cancel
Discussion of [NSURLConnection cancel]
After this method is called, the connection’s delegate no longer receives any messages for the connection. If you want to reattempt the connection, you should create a new connection object.
Example of [NSURLConnection cancel]
NSLog(@"Will cancel connection=%@", mgr.theConnection);
[mgr.theConnection cancel];
NSLog(@"Did cancel connection");
// [mgr.theConnection release]; assuming a retained property, this is not the way to do it
mgr.theConnection = nil; // this is the proper way - release and nil out the property
NSLog(@"Did release connection");
Example of [NSURLConnection cancel]
[connection cancel];