我以前可以cancelAllHTTPOperationsWithMethod:在AFHTTPClient类上使用来取消操作。取消操作的新方法是什么?
5514 次
1 回答
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];
AFURLSessionManageroperationQueue如果您更喜欢NSURLSession.
于 2013-10-07T23:50:34.050 回答