I am starting a AFHTTPRequestOperation to download some data from a server.
The action that triggers the download is text input from the user. I am working on making this dynamic, so if a user types: a, it will start fetching data for a. When a user adds another letter/changes the text, for example to ab, it will terminate the previous request and start a new one for ab. I am trying to have it dynamic.
Is there a way in AFNetworking to terminate a running request/operation?
You can call
cancelmethod on any operation…If u r using
AFHTTPClientthere is a methodcancelAllHTTPOperationsWithMethodto cancel an operation.Or u can use
NSMutableSetto track all the requests running in a view controller, and cancel one when u need.