首页 > 解决方案 > 在 Google Cloud Platform 中启用 Places API for iOS

问题描述

我正在尝试添加Place AutocompleteiOS 应用程序,但总是出现此错误。

The operation couldn’t be completed. The Places API for iOS is not enabled. See the developer's guide (https://developers.google.com/places/ios-api/start) for how to enable the Google Places API for iOS.

我正在尝试Places API for iOS在 Google Cloud Platform 中活动,但该选项未出现在 API 库列表中。有人知道为什么吗?我在 StackOverflow 中看到过不同的教程和帖子,但没有人解释原因。

我不知道我的帐户是否需要一些配置。

请参阅随附的屏幕截图。

Xcode 错误 在此处输入图像描述

启用 API 和服务 在此处输入图像描述

API 库列表 在此处输入图像描述

如您所见Places API for iOS,不在列表中。

标签: iosxcodegoogle-places-apigoogle-maps-sdk-ios

解决方案


我也遇到了这个问题,但发现这个答案很有帮助。

问题是GooglePlaces pod没有更新。当我们运行pod 时会自动设置版本pod install,但最新的是版本。GooglePlaces2.7.03.0.2

尝试pod update GooglePlaces --verbosepod不会正确更新,所以我最终直接将版本设置为podfile

  # Pods for myProject
    pod 'Alamofire', '~> 4.7'
    pod 'GoogleMaps', '~> 3.0.2'
    pod 'GooglePlaces', '~> 3.0.2'

然后pod install再次运行,“api未启用”错误消失了。


推荐阅读