Alamofire.AFError.ResponseValidationFailureReason.unacceptableStatusCode(500)

I had the same problem my friend and I resolved it by changing the status code from

validate(statusCode: 200..<500)

to

validate(statusCode: 200..<600)

I'm new to Alamofire so I cannot give you an explanation to why or how it works or what the error means.


An explanation of Cyril's accepted answer:

HTTP server functions conventionally return a status code that indicates what happened while processing the request. Alamofire can read this to determine if the response is valid, or an error occured. Depending on how your server was implemented, you can tell Alamofire the range of status codes that you consider to mean a 'valid' response, you do this by giving this range to the validate() function. For example, .validate(statusCode: 200..<500) tells Alamofire that any response with the status code 200 up to 499 should be considered valid, every other code (including 500) should be invalid.

Tags:

Alamofire