【问题标题】:Uber error code in iOS SDKiOS SDK 中的 Uber 错误代码
【发布时间】:2018-02-08 08:23:29
【问题描述】:

我已经集成了 Uber iOS SDK,现在可以使用沙盒模式。这是我的乘车请求代码。

[[UberHelper sharedInstance].ridesClient requestRideWithParameters:_rideParameters completion:^(UBSDKRide * _Nullable ride, UBSDKResponse * _Nonnull response) {NSLog(@"ERROR %@",response.error.title); NSLog(@"ERROR %@",response.error.code); NSLog(@"ERROR %ld",(long)response.statusCode);}];

但我期望的错误代码就像

"errors":[
      {
         "status": 409,
         "code": "surge",
         "title": "Surge pricing is currently in effect for this product."
      }
   ].

目前我只得到 "status"(response.error.status) 和 "code" (response.error.code) 和 "title"(response.error.title) 是 "null" 。我需要这个“标题”来显示错误警报。 这些数据会在生产模式下可用吗?

【问题讨论】:

  • 显示你尝试过的代码
  • @Anbu.karthik,下面是代码 [[UberHelper sharedInstance].ridesClient requestRideWithParameters:_rideParameters 完成:^(UBSDKRide * _Nullable 乘车,UBSDKResponse * _Nonnull 响应) { NSLog(@"ERROR %@" ,response.error.title); NSLog(@"ERROR %@",response.error.code); NSLog(@"ERROR %ld",(long)response.statusCode);}];
  • @Anbu.karthik,我得到 "status":401 和 "code":unauthorized, title:nil 上面的代码

标签: ios uber-api


【解决方案1】:

请按照此方式获取UBSDKError。

    if(response.error.errors){

                UBSDKError *uberError = [response.error.errors objectAtIndex:0];

                NSLog(@"title %@",uberError.title);
                NSLog(@"code %@",uberError.code);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-07
    • 1970-01-01
    • 2018-06-07
    • 1970-01-01
    相关资源
    最近更新 更多