【发布时间】:2016-12-13 09:52:19
【问题描述】:
当您单击按钮时,我尝试制作 uber 按钮,我想要的只是打开带有 dropoff Location 的 uber 应用程序。
我已经阅读了那里的 api (https://github.com/uber/rides-ios-sdk),我完全按照它所说的做了,但是当我按下 uber 按钮时,它所做的就是打开 uber 应用程序而没有任何丢弃位置。
这是我的代码,请指导我在哪里
CLLocation *loc = [[CLLocation alloc]initWithLatitude:26.410640 longitude:50.099568];
UBSDKRideRequestButton *button = [[UBSDKRideRequestButton alloc] init];
UBSDKRidesClient *ridesClient = [[UBSDKRidesClient alloc] init];
CLLocation *pickupLocation = [[CLLocation alloc] initWithLatitude: self.locationManager.location.coordinate.latitude longitude: self.locationManager.location.coordinate.longitude];
CLLocation *dropoffLocation = [[CLLocation alloc] initWithLatitude: loc.coordinate.latitude longitude: loc.coordinate.longitude];
__block UBSDKRideParametersBuilder *builder = [[UBSDKRideParametersBuilder alloc] init];
builder = [builder setPickupLocation: pickupLocation];
builder = [builder setDropoffLocation: dropoffLocation];
[ridesClient fetchCheapestProductWithPickupLocation: dropoffLocation completion:^(UBSDKUberProduct* _Nullable product, UBSDKResponse* _Nullable response) {
if (product) {
builder = [builder setProductID: product.productID];
button.rideParameters = [builder build];
[button loadRideInformation];
}
}];
[self.view addSubview:button];
【问题讨论】:
-
这可能不是原因,但看起来您将 dropoffLocation 与pickupLocation @
fetchCheapestProductWithPickupLocation混淆了。由于位置混淆,按钮上的时间和价格估计值应该不正确。 -
不,先生,来自开发者网站的目录