dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(queue, 0), ^{
dispatch_semaphore_t sema = dispatch_semaphore_create(1);
[网络请求:^{
//请求回调
NSLog(@"执行顺序1");
dispatch_semaphore_signal(sema);
}];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
NSLog(@"执行顺序2");
});
网友评论