I’m writing an NSOperation to make a web service request via a NSURLConnection. I would like to make the NSOperation able to be cancelled, so that a long-running HTTP request can be interrupted if necessary. If I make the HTTP request synchronously, it will block the thread and I can’t check isCancelled to terminate early. Making the HTTP request asynchronously from the NSOperation doesn’t make sense to me (where would the delegate methods be?). What’s the best way to do this?
I’m writing an NSOperation to make a web service request via a NSURLConnection .
Share
I would suggest using ASIHTTPRequest for this type of problem.
ASIHTTPRequestobjects areNSOperationsubclasses, and support cancelling, custom timeout periods, and blocks.