iOS 的地点 API 在 swift 中未启用

The Places API for iOS is not enabled in swift

我为相同的 Api 密钥启用了 Places Api 仍然有错误

UserInfo={NSLocalizedFailureReason=The Places API for iOS is not enabled. See the developer's guide (https://developers.google.com/places/ios/start) for how to enable the Google Places API for iOS.

请帮我解决这个错误。

请验证您的 GoogleInfoPlist 文件并使用您的帐户验证所有凭据。

GMSPlacesClient.provideAPIKey("YOUR_API_KEY")

匹配 GoogleInfoPlistFile 中的 API 键

这个问题已经不是关于编程的了。

The Places API for iOS is not enabled. See the developer's guide (developers.google.com/places/ios/start) for how to enable the Google Places API for iOS

很明显,Places API 未针对该键启用。因此,您需要仔细检查密钥是否正确(copy/paste 错误?),确定它已启用,尝试在该帐户上生成一个新的 API 密钥并尝试。

您还可以下载地点 API 的示例应用程序并在其中尝试您的 API 密钥,但如果它说它未启用,则它要么未在该帐户上启用或者 API 键错误,这不是代码更改,而是配置

请检查您的 Podfile 中的 GooglePlaces 版本。

我遇到了同样的问题,在将 Podfile 中的版本从 2.7.0 更新到 3.0.3 后它可以正常工作

  pod 'GooglePlaces', '= 3.0.3'
  pod 'GooglePlacePicker', '= 3.0.3'
  pod 'GoogleMaps', '= 3.0.3'

Installing GoogleMaps 3.0.3 (was 2.7.0)

Installing GooglePlaces 3.0.3 (was 2.7.0)

刚刚注意到文档中有一个 note 指出:

IMPORTANT: The Place Picker is deprecated as of January 29, 2019. This feature will be turned off on July 29, 2019, and will no longer be available after that date. To continue using the Place Picker through the deprecation period, do NOT migrate to the new SDK yet, and do NOT disable the Places SDK for iOS service in your Google Cloud Platform project, as doing so will also disable the Place Picker.