NSURLRequest *req = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:self.urlString]];
NSURLConnection *con = [[NSURLConnection alloc]
initWithRequest:req
delegate:self
startImmediately:NO];
[con scheduleInRunLoop:[NSRunLoop currentRunLoop]
forMode:NSRunLoopCommonModes];
[con start];
if (con) {
self.receivedData=[[NSMutableData alloc] init];
} else {
...
}
[req release];
With this code, I’m downloading an image.
How can I stop the downloading and close the connection during download?
NSURLConnection has a -cancel method.
Hope that helps!