2013-10-07 28 views

回答

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

+1

RequestOperation是iOS 6+和SessionManager是iOS 7+ afaik –

+0

它們都是以操作的思想來工作的。你只需要從你使用的對象中獲取它們。 –

相關問題