美文网首页
先执行block再return

先执行block再return

作者: 倪大头 | 来源:发表于2018-08-16 13:39 被阅读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;
    

    相关文章

      网友评论

          本文标题:先执行block再return

          本文链接:https://www.haomeiwen.com/subject/wjonbftx.html