【问题标题】:Uber button doesn't display price, but only time优步按钮不显示价格,只显示时间
【发布时间】:2018-05-31 00:04:46
【问题描述】:

这是我第一次使用 Uber api。我清楚地遵循了说明,但它从未真正提到如何在按钮中显示价格估算。我的代码神奇地显示了时间(不知道为什么或如何)。请解释如何显示价格。服务器令牌和客户端 ID 都已集成到 info.plist 文件中。

class ViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()

    let button = RideRequestButton()
    view.addSubview(button)
    button.center = view.center
    let ridesClient = RidesClient()
    let dropOffLocation = CLLocation(latitude: 20.301647, longitude: 85.819135)
    let pickUpLocation = CLLocation(latitude : 20.323706, longitude: 85.814981)
    let builder = RideParametersBuilder()
    builder.pickupLocation = pickUpLocation
    builder.pickupNickname = "Home"
    builder.dropoffLocation = dropOffLocation
    builder.dropoffNickname = "Mayfair Lagoon, Bhubaneswar"

    var productID = ""
    ridesClient.fetchProducts(pickupLocation: pickUpLocation) { (product, response) in
        productID = product[1].productID
        print("????\(productID)")
    }


    ridesClient.fetchPriceEstimates(pickupLocation: pickUpLocation, dropoffLocation: dropOffLocation) { (price, response) in

        print(price[0].estimate!,"????")
    }

    ridesClient.fetchTimeEstimates(pickupLocation: pickUpLocation) { (time, response) in
        print("????",time[0].estimate,"????")
    }


    builder.productID = productID

    button.setContent()
    button.rideParameters = builder.build()
    button.loadRideInformation()

}

}

【问题讨论】:

  • 你好@SanketRay你有解决按钮如何显示票价的解决方案
  • @KanhaiyaSharma 还没有:( Uber 没有人回复。

标签: ios uber-api


【解决方案1】:

按钮将深度链接到 Uber 应用程序,并且会简单地打开应用程序。为了查看实时票价估算和接送 ETA 信息,您需要向其传递其他参数。乘车请求按钮可以接受可选参数以将一些信息预加载到乘车请求中。您可以在Uber documentation 中查看如何操作。这也是在 GitHub 上的 here 解释

请查看 StackOverflow 线程 here。 解释并记录了如何管理此问题。

【讨论】:

  • 只是从另一个帖子复制答案没有帮助!...您复制答案的另一个帖子是我的原始帖子。
【解决方案2】:
猜你喜欢
  • 2011-10-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-08-09
  • 2021-10-15
相关资源
最近更新 更多