什么是AFNetworking 2.0等效取消操作

时间:2013-10-07 23:42:15

标签: ios objective-c afnetworking-2

我以前能够在cancelAllHTTPOperationsWithMethod:类上使用AFHTTPClient取消操作。取消操作的新方法是什么?

1 个答案:

答案 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属性。