Search code examples
iphoneobjective-ciosios5nsurlconnection

How can I cancel an asynchronous call through NSURLConnection sendAsynchronousRequest?


I've got a web service call performing some validation on user input in real time. I'd like to use [NSURLConnection sendAsynchronousRequest] on the validation (which was introduced in iOS 5), but cancel it if the user changes the input field content in the mean time. What is the best way to cancel a current request?


Solution

  • It doesn't appear that there is a good way to do this. The solution seems to be to not use the new [NSURLConnection sendAsynchronousRequest] in situations in which you need to cancel the request.