7
我曾經可以在AFHTTPClient
類上使用cancelAllHTTPOperationsWithMethod:
取消操作。什麼是取消操作的新方法?什麼是AFNetworking 2.0相當於取消操作
我曾經可以在AFHTTPClient
類上使用cancelAllHTTPOperationsWithMethod:
取消操作。什麼是取消操作的新方法?什麼是AFNetworking 2.0相當於取消操作
您可以手動取消操作。您可以從操作隊列中獲取的操作:
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
。
RequestOperation是iOS 6+和SessionManager是iOS 7+ afaik –
它們都是以操作的思想來工作的。你只需要從你使用的對象中獲取它們。 –