user940026
user940026

Reputation: 41

How to send batch request by using AFNetworking 3.0

I use AFNetworking 3.0 and I want to send batch request. AFNetworking 2.0 is support enqueueBatchOfHTTPRequestOperations:progressBlock:completionBlock not AFNetworking 3.0.

How can I send a batch of requests using AFHTTPSessionManager?

Upvotes: 4

Views: 1194

Answers (1)

Andrea
Andrea

Reputation: 26385

In AFNetworking 3.0 there is not an API to do that. Basically this is because it uses NSURLSession instead of wrapping NSURLConnection into NSOperation.
You have some options:

  • Use GCD dispatch groups
  • Make your own implementation for wrapping NSURLSession into NSOperation, just need to make the NSOperation observe the state NSURLSession property and add dependency between operations before adding to the NSOperationQueue
  • Use promises, you can find a lot of implementations on GITHUB

Upvotes: 1

Related Questions