You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there,
The crash appears to occur because UberKit assumes a value for every field even though sometimes the Uber API doesn't return a value for some fields, in this case, for a metered cab. Your solution to the issue seems apt. I just pushed an update that features your solution.
Thanks,
Sachin
I got response where estimated prices were not available. It caused app to crash.
Log:
2014-08-30 15:22:08.236 UberKitDemo[5996:4007] Object being sent to price {
"currency_code" = USD;
"display_name" = UberSUV;
estimate = "$118-150";
"high_estimate" = 150;
"localized_display_name" = UberSUV;
"low_estimate" = 118;
"product_id" = "8920cb5e-51a4-4fa4-acdf-dd86c5e18ae0";
"surge_multiplier" = 1;
}
2014-08-30 15:22:08.237 UberKitDemo[5996:4007] Object being sent to price {
"currency_code" = "";
"display_name" = uberTAXI;
estimate = Metered;
"high_estimate" = "";
"localized_display_name" = uberTAXI;
"low_estimate" = "";
"product_id" = "3ab64887-4842-4c8e-9780-ccecd3a0391d";
"surge_multiplier" = 1;
}
2014-08-30 15:22:08.237 UberKitDemo[5996:4007] -[NSNull intValue]: unrecognized selector sent to instance 0x1940068
2014-08-30 15:22:08.245 UberKitDemo[5996:4007] *** Terminating
My fix:
UberPrice.m, line 40:
_lowEstimate = -1;
_highEstimate = -1;
NSString *lowE = [dictionary objectForKey:@"low_estimate"];
NSString *highE = [dictionary objectForKey:@"high_estimate"];
if ( ![lowE isKindOfClass:[NSNull class]] )
_lowEstimate = [lowE intValue];
if ( ![highE isKindOfClass:[NSNull class]] )
_highEstimate = [highE intValue];
UberKit.m, line 92:
for(int i=0; i<prices.count; i++)
{
NSLog(@"Object being sent to price %@", [prices objectAtIndex:i]);
UberPrice *price = [[UberPrice alloc] initWithDictionary:[prices objectAtIndex:i]];
if ( price.lowEstimate > -1) //added this
[availablePrices addObject:price];
}
The text was updated successfully, but these errors were encountered: