我以前能够在cancelAllHTTPOperationsWithMethod:
类上使用AFHTTPClient
取消操作。取消操作的新方法是什么?
答案 0 :(得分:21)
您可以手动取消操作。您可以从操作队列中获取操作:
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
, operationQueue
也会有NSURLSession
属性。