【发布时间】:2015-11-29 16:13:16
【问题描述】:
如何更改超时间隔时间以在 Alamofire 中获得长时间运行的 API 响应。
我尝试过以下代码:
let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
configuration.timeoutIntervalForRequest = 300.0 // seconds
let alamofireManager = Alamofire.Manager(configuration: configuration)
alamofireManager.request(method, urlString, parameters: parameters)
.authenticate(user: primaryUserName, password: primaryPassword)
.validate(contentType: ["application/json"])
.responseJSON {
alamofireResponse in
if alamofireResponse.response == nil {
print("nil response")
}
}
但它没有得到任何数据。响应为零。现在可以做什么?谢谢。
【问题讨论】:
-
你能解决这个问题吗?