If I enter wrong password then I am unable to print the exact error message which api is sending it to me.
po error.localizedDescription
I am always getting default message from alamofire i.e. "Response status code was unacceptable: 401.". It should print the dynamic error message like Invalid username and password.
Btw I can use responseJson to print the dynamic error message using
.responseJSON { response in
if response.response?.statusCode == 200 {
print("Success with JSON: \(response.result.value)")
}
else {
let error = response.result.value as! NSDictionary
let errorMessage = error.object(forKey: "message") as! String
print(errorMessage)
}
But how I should do the same with responseObject ?
If I enter wrong password then I am unable to print the exact error message which api is sending it to me.
po error.localizedDescription
I am always getting default message from alamofire i.e. "Response status code was unacceptable: 401.
". It should print the dynamic error message likeInvalid username and password
.Btw I can use responseJson to print the dynamic error message using
But how I should do the same with
responseObject
?