dispatch_apply

参考:https://www.jianshu.com/p/3b12bb90bb15

NSArray *dictArray = nil;//存放从服务器返回的字典数组

dispatch_queue_t queue = dispatch_queue_create("queue", DISPATCH_QUEUE_CONCURRENT);

dispatch_async(queue, ^{
       
        dispatch_apply(dictArray.count, queue,  ^(size_t index){
            //字典转模型
        });

        dispatch_async(dispatch_get_main_queue(), ^{
            NSLog(@"主线程更新");
        });
});

你可能感兴趣的:(dispatch_apply)