替代AFNetworking 2.0中的enqueueHTTPRequestOperation [英] Alternative for enqueueHTTPRequestOperation in AFNetworking 2.0

查看:209
本文介绍了替代AFNetworking 2.0中的enqueueHTTPRequestOperation的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

We need to download files concurrently in our application.

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

In earlier version of AFNetworking we have downloaded 2 files concurrently by using the code below:

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

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

Now we want to upgrade our AFNetworking to 2.0.

我们使用的是 AFHTTPRequestOperationManager 而不是 AFHTTPClient 设置

Instead of AFHTTPClient we are using AFHTTPRequestOperationManager and able to set

  setMaxConcurrentOperationCount: value 

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

But we are manually starting our download process. I am looking for alternative(enqueueHTTPRequestOperation in 2.0) for this to download automatically.

推荐答案

我在中找到了属性 operationQueue AFHTTPRequestOperationManager

I found the property operationQueue in AFHTTPRequestOperationManager

所以也许试试这个

[self.operationQueue addOperation:downloadObj.downloadOperation];

这篇关于替代AFNetworking 2.0中的enqueueHTTPRequestOperation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆