【问题标题】:Google Places API for iOS vs Google places Web service适用于 iOS 的 Google Places API 与 Google Places Web 服务
【发布时间】:2015-11-08 15:51:40
【问题描述】:

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

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

  • Google Places API 网络服务

  • 适用于 iOS 的 Google Places API

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

  1. 何时使用 Google Places API Web Service 以及何时使用 Google Places API for iOS ?以及在我的情况下最有效的方法(获取带有分页的地点列表并按名称和类别选项过滤)

  2. 我已经为 Google Places API for iOS 生成了一个 API-KEY,我还能在 Google Places API 网络服务中使用这个密钥吗?

【问题讨论】:

    标签: ios objective-c web-services google-maps google-places-api


    【解决方案1】:

    一般来说,如果为 iOS 开发,您应该更喜欢适用于 iOS 的 Google Places API。它被设计成在 iOS 上比使用 Web 服务更易于使用和更高效。

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

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

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

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

    【讨论】:

    • 这有帮助。我认为我必须将两者结合起来。
    • 我们能否使用适用于 iOS 的 Google Places API 手动安装而不是 PODS?我们曾经在使用 Cocoapods 时做了一场噩梦(cocoapods 的一个更新被破坏了一些方式 = 大混乱)。由于它仍然相对较新,仍然可以使用 WebService Api 吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-02-08
    • 2014-03-18
    • 1970-01-01
    • 1970-01-01
    • 2018-02-11
    • 2012-08-31
    • 2017-08-26
    相关资源
    最近更新 更多