把iOS中block代码异步执行通过信号量变成同步执行

源码链接

 dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
        
        [self downZipFile:^(BOOL downSucceed) {
            dispatch_semaphore_signal(semaphore);
        }];
         dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);

猜你喜欢

转载自blog.csdn.net/liuyinghui523/article/details/79926587