Reputation: 308
I have a number of API calls I need to send off and then want to do something only when they all return, like [SVProgressHUD dismiss];
What is the best way to do that?
Upvotes: 0
Views: 221
Reputation: 119031
It depends how you're making the requests, but RKObjectManager
offers a number of options:
The RKObjectManager
gives you access to the operationQueue
on which the requests are running so you can check the operationCount
.
The RKObjectManager
also lets you enqueueBatchOfObjectRequestOperations:...
with a progress and a completion callback.
Yet more, the RKObjectManager
also lets you search for pending requests using enqueuedObjectRequestOperationsWithMethod:...
.
Upvotes: 1
Reputation: 41642
Create a mutable NSArray and add some identifier to it when you send the request, and delete it when you get a response, and when the array is empty you are done.
Upvotes: 0