iOS GCD Sync with Async Block
问题 I have an async function with a block : [self performAsyncTaskCompletion:(void(^) () ) { //Do Something } ]; I need to call this function many times but in a synchronous way. I tried to use GCD queues : dispatch_queue_t queue = dispatch_queue_create("com.MyApp.task", NULL); for (int i = 0; i < array.count; i++) { dispatch_sync(queue, ^{ [self performAsyncTaskCompletion:(void(^) () ) { //Do Something } ]; }); } But it doesn't work because dispatch_sync is only waiting for the end of the block.