gpt4 book ai didi

ios - 适用于 iOS 的 Google Places API 与 Google Places Web 服务

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:39:57 26 4
gpt4 key购买 nike

我计划有一个应用程序来在 UITableView 中列出附近的地点,其中 UISearchController 结合自动完成功能来过滤地点的结果,我正在尝试使用 Google Places API。

我很困惑,因为我不知道应该使用哪个 API:

  • Google Places API 网络服务

  • 适用于 iOS 的 Google Places API

我在 iOS 版 Google Places API 文档中找不到获取地点列表的方法。

  1. 何时使用 Google Places API Web Service 以及何时使用 Google Places API for iOS?以及最适合我的情况(获取具有分页的地点列表并按名称和类别选项进行过滤)

  2. 我已经为 Google Places API for iOS 生成了一个 API-KEY 我还能在 Google Places API Web Service 中使用这个 key 吗?

最佳答案

一般来说,如果针对 iOS 进行开发,您应该更喜欢适用于 iOS 的 Google Places API。与使用 Web 服务相比,它在 iOS 中更易于使用且更高效。

但是,适用于 iOS 的 Places API 相对较新,还不具备 Web 服务的所有功能。在这种情况下,您可能更愿意只使用 Web 服务,或者将 Places API for iOS 和 Web 服务结合起来。

对于您的特定用例,我建议使用 Places API for iOS getCurrentPlace 功能 + 自动完成。 getCurrentPlace 返回我们认为设备所在位置的列表。

如果这不能满足您的需求,您可以使用 Web 服务的附近搜索 + iOS API 的自动完成。

对于问题 #2:您不能对 iOS 和 Web 服务使用相同的 API key 。前者需要 iOS Key,后者需要 Server key。您还需要在 Google Developers Console 中启用这两项服务。

关于ios - 适用于 iOS 的 Google Places API 与 Google Places Web 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32026175/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com