先执行block再return

2018-08-16  本文已影响16人  倪大头
dispatch_semaphore_t signal = dispatch_semaphore_create(0);

dask = [NetWorkManager PostWithUrl:KAPI_RCIM_ConversationRelation Params:@{@"token":[UserManager share].userModel.token, @"to_user_id": modelIDString} successHander:^(id reponse) {
        if ([reponse[@"code"] integerValue] == 0) {
            dispatch_semaphore_signal(signal);
        }else {
            dispatch_semaphore_signal(signal);
        }
} returnFailHander:^(id returnFail) {
        dispatch_semaphore_signal(signal);
} failHander:^(NSError *error) {
        dispatch_semaphore_signal(signal);
}];
    
dispatch_semaphore_wait(signal, DISPATCH_TIME_FOREVER);
return someThing;
上一篇下一篇

猜你喜欢

热点阅读