ios - AFNetworking 2.0 中 enqueueHTTPRequestOperation 的替代方案

标签 ios objective-c afnetworking-2 afhttpclient

我们需要在我们的应用程序中同时下载文件。

在早期版本的 AFNetworking 中,我们使用以下代码同时下载了 2 个文件:

(AFHTTPClient)
[_httpClient.operationQueue setMaxConcurrentOperationCount:MAX_CONCURRENT_OPERATIONS];
[self.httpClient enqueueHTTPRequestOperation:downloadObj.downloadOperation];  

现在我们要将 AFNetworking 升级到 2.0。

我们使用 AFHTTPRequestOperationManager 而不是 AFHTTPClient 并且能够设置

  setMaxConcurrentOperationCount: value 

但是我们正在手动开始我们的下载过程。我正在寻找替代方案(2.0 中的 enqueueHTTPRequestOperation)以便自动下载。

最佳答案

我在 AFHTTPRequestOperationManager 中找到属性 operationQueue

也许试试这个

[self.operationQueue addOperation:downloadObj.downloadOperation];

关于ios - AFNetworking 2.0 中 enqueueHTTPRequestOperation 的替代方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21850800/

相关文章:

ios - 在 iOS 7 上使用 iOS 7 之前的外观

ios - 是否可以在 UISearchBar 键盘中添加键盘预测选项

objective-c - 检查 iOS 上的 Facebook 权限

ios - AFNetworking 单例类问题

ios - 无法导入AFHTTPRequestOperationLogger

iphone - GestureRecogniser 并禁用 UIScrollView 中 UIView 的拖动手势

javascript - 在 Android WebView 上阻止 JS deviceorientation devicemotion

ios - 如何在 AudioEngine 的默认 inputNode 上安装 tap 并写入文件

php - AFNetworking 2.0 POST 问题,Cocoa 错误 3840(JSON 文本没有以数组开头...)

ios - iCloud 同步无处不在的错误