iOS 执行完block代码块再执行下一步

//创建一个信号量(值为0)

dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);

[[AFNetWorkTool shareNetWorkTool] getWarningListwithPage2:[NSString stringWithFormat:@"1"] andFinishBlock:^(id object){

NSLog(@"1");

dispatch_semaphore_signal(semaphore);

}];

//信号量减1,如果>0,则向下执行,否则等待

dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);

NSLog(@"222");

你可能感兴趣的:(iOS 执行完block代码块再执行下一步)