let manager = Alamofire.SessionManager.default
manager.session.configuration.timeoutIntervalForRequest = 120
manager.request("yourUrl", method: .post, parameters: ["parameterKey": "value"])
.responseJSON {
response in
switch (response.result) {
case .success:
//do json stuff
break
case .failure(let error):
if error._code == NSURLErrorTimedOut {
//timeout here
}
print("\n\nAuth request failed with error:\n (error)")
break
}
}
网友评论