我正在尝试发送数千个 http 请求,但由于内存问题,我的应用程序崩溃了。“由于内存问题而终止”。所以我想在继续循环发送另一个请求之前等待响应。
for i in 0 ..< 10000 {
Alamofire.request("https://httpbin.org/get", parameters: ["foo": "bar"]).responseJSON { response in
print("Finished request \(i)")
// Continue the looping
}
}