dispatch_group_t or dispatch_semaphore_t to wait for multiple async requests to complete
<p>I need to wait for several requests to complete before I can move on to the next task. dispatch_group_t &amp; dispatch_semaphore_t like quite similar here. So I was wondering which one is better or there is no much difference here.</p>

<pre><code>dispatch_group_t serviceGroup = dispatch_group_create();
dispatch_group_enter(serviceGroup);
// in completion block
dispatch_group_leave(serviceGroup);

//wait for all requests to complete
dispatch_group_notify(serviceGroup,dispatch_get_main_queue(),^{
    // Won't get here until everything has finished
});

/* Or I can use dispatch_semaphore_t */

dispatch_semaphore_t sem = dispatch_semaphore_create(0);
// in completion block
dispatch_semaphore_signal(sem);
// before start request
dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
// Reaching here means all requests has completed
...
</code></pre>