Is it possible to cancel an
NSURLConnection
started withsendAsynchronousRequest:queue:completionHandler:
?Why doesn't
sendAsynchronousRequest:queue:completionHandler:
return theNSURLConnection
object it creates so that I can cancel it?
Cancel NSURLConnection started with sendAsynchronousRequest:queue:completionHandler:?
3.9k views Asked by ma11hew28 At
1
EDIT - Since my provided answer seems to have been wrong, you should check out the following related question and its answers:
How can I cancel an asynchronous call through NSURLConnection sendAsynchronousRequest?
Old answer:
In your header of your class (e.g. ViewController), declare an operation queue:
To download a file call something like the following:
To cancel the download later on call: