What is AFNetworking 2.0 equivalent for canceling operations?

I used to be able to use cancelAllHTTPOperationsWithMethod: in the AFHTTPClient class to cancel operations. What is the new cancellation method?

+7
ios objective-c afnetworking-2
source share
1 answer

You can cancel operations manually. You can get operations from the operation queue:

 AFHTTPRequestOperationManager *manager = // ... for (NSOperation *operation in manager.operationQueue.operations) { // here you can check if this is an operation you want to cancel [operation cancel]; } // or just cancel all of them! [manager.operationQueue cancelAllOperations]; 

AFURLSessionManager also have the operationQueue property if you are more in NSURLSession .

+21
source share

All Articles