iOS SDK

时间:2018-02-08 08:23:30

标签: ios uber-api

我已经集成了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" 。我需要这个"标题"来显示错误提示。 这些数据是否可以在生产模式下使用?

1 个答案:

答案 0 :(得分:1)

请按照这种方式获取UBSDKError。

    if(response.error.errors){

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

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