gpt4 book ai didi

ios - 如何处理这个 : There are five api requests running parallelly and 2nd request is dependent on 4th request's response

转载 作者:行者123 更新时间:2023-11-28 21:25:49 29 4
gpt4 key购买 nike

我遇到了一个问题,我想知道更好的解决方法。

有五个 api 请求并行运行,第二个请求依赖于第四个请求的响应,但所有 5 个请求都已在运行。什么是更好的方法?

需要建议。提前致谢。

最佳答案

调度地面工作正常。

//create a dispatch group
dispatch_group_t serviceGroup = dispatch_group_create();

//request 1
dispatch_group_async(serviceGroup,queue,^{
// some work here
});

//request 3
dispatch_group_async(serviceGroup,queue,^{
// some work here
});

//request 5
dispatch_group_async(serviceGroup,queue,^{
// some work here
});

//request 4
dispatch_group_enter(serviceGroup);
[something startWithCompletion:^() {
//result
dispatch_group_leave(serviceGroup);
//request 2
}];

关于ios - 如何处理这个 : There are five api requests running parallelly and 2nd request is dependent on 4th request's response,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38115763/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com