我在我的应用中使用Uber Api。当我尝试预订时会出现问题。我收到了httpStatus 400错误。根据他们的文档,这可能是由于各种因素造成的。
如何通过状态代码(始终为“400”)了解给定类型的哪种描述会导致它?。
我的代码现在:
if let httpstatuscode = response as? NSHTTPURLResponse
{
if (error != nil)
{
print("Error : \(error?.localizedDescription)")
}
else if httpstatuscode.statusCode != 202 && httpstatuscode.statusCode != 409
{
print("Status Code\(httpstatuscode.statusCode)")
dispatch_async(dispatch_get_main_queue(), { () -> Void in
CommonViewController.alertViewUI("Alert", message: "Internal Server Error!")
})
}
else if httpstatuscode.statusCode == 409
{
// self.getUberRideLive()
print("Status Code\(httpstatuscode.statusCode)")
CommonViewController.alertViewUI("Alert", message: "You are already on a ride!")
}