2017-05-31 5 views
0

私はiOSアプリケーション用にUber-SDKを使用しています。ここ数日、ridesClient.fetchCheapestProduct()でもっとも安い商品を手に入れることができます。しかし今日、その関数は常にnilの値を返します。Rides-ios-sdk - 最も安い製品を手に入れよう

これはサーバーまたはSDKに問題がありますか?この問題で私を助けてください。 (私はベトナムにいるよと私のclient_idはまだAndroid向け正常に動作します)

これは私のコードです:

let ridesClient = RidesClient() 
let button = RideRequestButton() 

override func viewDidLoad() { 
    super.viewDidLoad() 

    let pickupLocation = CLLocation(latitude: 37.775159, longitude: -122.417907) 
    let dropoffLocation = CLLocation(latitude: 37.6213129, longitude: -122.3789554) 

    //make sure that the pickupLocation and dropoffLocation is set in the Deeplink 
    var builder = RideParametersBuilder() 
     .setPickupLocation(pickupLocation) 
     // nickname or address is required to properly display destination on the Uber App 
     .setDropoffLocation(dropoffLocation, nickname: "San Francisco International Airport") 

    // use the same pickupLocation to get the estimate 
    ridesClient.fetchCheapestProduct(pickupLocation: pickupLocation, completion: { product, response in 
     if let productID = product?.productID { //check if the productID exists 
      builder = builder.setProductID(productID) 
      self.button.rideParameters = builder.build() 

      // show estimate in the button 
      self.button.loadRideInformation() 
     } 
    }) 


    // center the button (optional) 
    button.center = view.center 

    //put the button in the view 
    view.addSubview(button) 
} 

答えて

1

あなたがserver token in your Info.plistを設定していることを確認します。これにより、RidesClient()は価格見積もりAPI呼び出しを行うことができます。

Info.plist(右クリックして[開く]> [ソースコード]を選択)にダッシュボードのYOUR_SERVER_TOKENをサーバートークンに置き換えます(クライアントIDに対応するサーバートークンを使用してください)。

<key>UberServerToken</key> 
<string>YOUR_SERVER_TOKEN</string> 
関連する問題