AFHTTPRequestOperationManager
instances are cheap to create and each has its own operation queue, so it is easy to cancel all of a given UIViewController
's operations:
- (void)dealloc {
[self.requestOperationManager.operationQueue cancelAllOperations];
}
This will cancel any request created through self.requestOperationManager
. You can create the AFHTTPRequestOperationManager
in your UIViewController
's init method.
I recommend cancelling operations in your view controller's dealloc method, as you know it will no longer be needed.