0
对不起,对于初学者的问题。 我有一个操作取决于从网络返回的数据的结果,并且操作可能需要另一个网络请求。由于第一个网络请求已经在datatask中调用过了,我想为第二个网络请求使用同一个线程,但不知道如何去做。任何提示? TKS迅速,在同一任务的线程中另一次调用网络
let task = URLSession.shared.dataTask(with: request as URLRequest)
{ data, response, error in
if func_1 (data) {
return
}else {
//call another network request here, but don't want to do
//another task = URLSession.shared.... again since we are already on an async thread
}
}