1
I have the following code to call the server
Alamofire.request(mutableURLRequest)
.responseJSON{ request, response, result in
response in
if let value: AnyObject = response.result.value {
let post = JSON(value)
print(post[0])
}
else
{
print("**ERRO**")
}
}
My question is how can I know if there have been errors in communication and put a team out if it is taking too long.
I have tried the following code to get the possible errors:
Alamofire.request(.GET, URLString, parameters: ["foo": "bar"])
.responseJSON { request, response, result in
switch result {
case .Success(let JSON):
print("Success with JSON: \(JSON)")
case .Failure(let data, let error):
print(error)
}
}
But I get the following error:
Contextual type for closure argument list expects 1 argument, but 3 Were specified