Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8308015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:40:24+00:00 2026-06-08T18:40:24+00:00

I have several asynchronous calls which I would combine in one call: -(void) loadA:(ArrayBlock)completion

  • 0

I have several asynchronous calls which I would combine in one call:

-(void) loadA:(ArrayBlock)completion failure(FailureBlock):failure;
-(void) loadB:(ArrayBlock)completion failure(FailureBlock):failure;
-(void) loadC:(ArrayBlock)completion failure(FailureBlock):failure;

The combined method, which uses the calls above:

- (void) loadAll:(ObjectBlock)completion;

The completion block contains an object with three arrays called array[A-C]. If any of the child calls fail the respective array in the object is simply set to nil.

Instead of nesting those three blocks and calling the next one on failure or completion of the preceding (This gets really messy) – I want to do something like the following using GCD:

  1. Add all calls to queue
  2. Wait until all calls have finished (either success or failure block was called)
  3. Combine all the results from the completion blocks and call the completion block of the loadAll method.

I know this is possible in GCD with synchronous calls but I don’t see how to achieve this with my three asynchronous “child calls”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:40:24+00:00Added an answer on June 8, 2026 at 6:40 pm

    Read up on dispatch groups – you can do a synchronous wait on them. And really, messy is the wrong word – a bit complex might be stating it better. I’ve had great luck with nested dispatch blocks and using groups to wait for intermediate results. You can also use dispatch_async_barrier to prevent blocks already in the queue to finish before that block gets executed. Blocks can add blocks to their dispatch queue too!

    I recall there being dependencies but I can’t find that section now in the CGD literature.

    What I really suggest you do is sketch this out on a piece of paper with a pencil, and once you convince your self you know how its going to work start coding.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a one main Workflow which calls several activities asynchronously. Some of the
I have several asynchronous jobs that I would like to transparently handle the exception
I have a web page with several jQuery ajax calls which fire asynchronously at
I have a silverlight 5 app that depends on several asynchronous calls to web
I have several different numbers in a group that range in sizes and would
We have several offices around the US and one in India. Our IT department
I have several UITableViews and what I would like to do is to be
I have a class WebServiceCaller that uses NSURLConnection to make asynchronous calls to a
I have a page which issues several ajax queries in $('document').ready() . I want
I have several methods (involving network operations) which take quite a long time. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.