Alternative for enqueueHTTPRequestOperation in AFNetworking 2.0

半腔热情 提交于 2020-01-01 10:28:07

问题


We need to download files concurrently in our application.

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];  

Now we want to upgrade our AFNetworking to 2.0.

Instead of AFHTTPClient we are using AFHTTPRequestOperationManager and able to set

  setMaxConcurrentOperationCount: value 

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


回答1:


I found the property operationQueue in AFHTTPRequestOperationManager

So maybe try this

[self.operationQueue addOperation:downloadObj.downloadOperation];


来源:https://stackoverflow.com/questions/21850800/alternative-for-enqueuehttprequestoperation-in-afnetworking-2-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!