2016-08-07 7 views
0

ボタンをクリックするとuberボタンを作成しようとしましたが、私が望むのは、dropoffの場所を持つuberアプリケーションを開いていることです。私のアプリケーションと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]; 
+0

これは原因ではない可能性がありますが、dropoffLocationとpickupLocation @ '' fetchCheapestProductWithPickupLocation'を混在させているようです。場所の混在により、ボタンの時間と価格の見積もりが正しくないはずです。 – agraebe

+0

開発者サイト –

答えて

1

技術的には、RideRequestButtonはユーバーアプリにパラメータを送信するためにディープリンクを使用してどこに私のコードです

は私を導いてください。 very button of the README sectionに記載されているとおり、その場所のニックネームまたは書式付きのアドレスを指定する必要があります。そうしないと、ピンは表示されません。

これを達成するためにコードを更新しました。あなたはそれを試して、それが動作するかどうか私に知らせますか?

CLLocation *dropoffLocation = [[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]; 
__block UBSDKRideParametersBuilder *builder = [[UBSDKRideParametersBuilder alloc] init]; 
builder = [builder setPickupLocation: pickupLocation]; 
[[builder setPickupLocation:pickupLocation] 
builder = [builder setDropoffLocation: dropoffLocation nickname: @"Somewhere" address:@"123 Fake St."]; 
[ridesClient fetchCheapestProductWithPickupLocation: pickupLocation completion:^(UBSDKUberProduct* _Nullable product, UBSDKResponse* _Nullable response) { 
    if (product) { 
     builder = [builder setProductID: product.productID]; 
     button.rideParameters = [builder build]; 
     [button loadRideInformation]; 
    } 
}]; 

[self.view addSubview:button]; 
+0

からディレクトリが届いていません問題が解決した場合は、このスレッドに解決してください。どうも! – agraebe

+0

それは私の問題を解決しなかった、Uberアプリはまだドロップオフの場所なしで開きます。 –

+2

fetchCheapestProductWithPickupLocationが正常に実行されていますか?そうでない場合は、ライドパラメータを決して設定しません。私は、その呼び出しを行う前に乗り物のパラメータを設定し、それが戻ったときに製品IDを含むように更新することをお勧めします。 –

関連する問題