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
}
}