在Google云端平台中启用适用于iOS的Places API

问题描述 投票:4回答:1

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

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.

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

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

请参阅附带的屏幕截图。

Xcode错误enter image description here

启用API和服务enter image description here

API库列表enter image description here

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

ios xcode google-places-api google-maps-sdk-ios
1个回答
1
投票

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

问题是GooglePlaces pod没有更新。当我们运行pod install时,GooglePlaces pod自动设置版本2.7.0但最新版本是3.0.2

当尝试pod update GooglePlaces --verbose时,pod将无法正确更新,所以我最终直接在podfile上设置版本,如下所示:

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

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

© www.soinside.com 2019 - 2024. All rights reserved.