AFNetworking 2.0中的enqueueHTTPRequestOperation的替代方法
我们需要在我们的应用程序中同时下载文件。
在AFNetworking的早期版本中,我们使用下面的代码同时下载了2个文件:
(AFHTTPClient) [_httpClient.operationQueue setMaxConcurrentOperationCount:MAX_CONCURRENT_OPERATIONS]; [self.httpClient enqueueHTTPRequestOperation:downloadObj.downloadOperation];
现在我们要把我们的AFNetworking升级到2.0。
我们使用的是AFHTTPRequestOperationManager
,而不是AFHTTPClient
setMaxConcurrentOperationCount: value
但我们正在手动开始我们的下载过程。 我正在寻找替代(enqueueHTTPRequestOperation 2.0)为此自动下载。
我在AFHTTPRequestOperationManager
find了属性operationQueue
所以也许试试这个
[self.operationQueue addOperation:downloadObj.downloadOperation];