I am assuming you are talking about canceling asynchronous ASIHTTPRequest
?
To cancel an asynchronous request i.e. a request that was started with [request startAsynchronous]
call [request cancel]
.
Btw, by canceling a request ASIHTTPRequest
treats it as an error and will call your delegate's failure method. If you do not want this behaviour, set your delegate to nil before calling cancel, or use the clearDelegatesAndCancel
method instead. like so -
// Cancels an asynchronous request
[request cancel]
// Cancels an asynchronous request, clearing all delegates and blocks first
[request clearDelegatesAndCancel];
But since you are talking about multiple requests, I would suggest you use a queue. Canceling requests could then be done in one shot using [queue cancelAllOperations];
.