Google Maps iOS API密钥无效 [英] Google Maps iOS API key not working

查看:146
本文介绍了Google Maps iOS API密钥无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的iOS应用程序,我正在整合Google地图。但是,当我的地图视图显示时,我提供的API密钥会导致其中一些错误消息:

I have a simple iOS app into which I am integrating Google Maps. However, the API key I've provided results in several of these error messages when my map view is displayed:

ClientParametersRequest失败,剩余3次尝试(0 vs 5)。错误域= com.google.HTTPStatus代码= 400无法完成操作。(com.google.HTTPStatus错误400.)UserInfo = 0x1818bf40 {data =< CFData 0x18137410 [0x302aec8]> {length = 145 ,容量= 256,字节= ...}}

这是我已经尝试过无效的事情:

Here is what I have already tried to no avail:


  • 调用 [GMSServices provideAPIKey:] 作为中的第一行代码didFinishLaunchingWithOptions

  • 仔细检查我的API密钥是否正确并且是iOS API密钥(我将其直接从Google Cloud Console复制/粘贴到我的应用中)

  • 使用 {} 提供API密钥而不使用

  • 通过输出确认我的包名称它与 [[Bundle mainBundle] bundleIdentifier]

  • 完全省略捆绑标识符限制

  • 重新生成API密钥

  • Calling [GMSServices provideAPIKey:] as the first line of code within didFinishLaunchingWithOptions
  • Double-checking that my API key is correct and is an iOS API key (I copy/pasted it directly from the Google Cloud Console into my app)
  • Providing the API key both with {} and without
  • Confirming my bundle name by outputting it with [[Bundle mainBundle] bundleIdentifier]
  • Omitting bundle identifier restrictions altogether
  • Regenerating the API key

我不知道还有什么可以尝试。我的捆绑包名称采用以下格式: net.company.MyApp 我已将其完全输入到Google云端控制台(我知道捆绑包ID区分大小写)。

I am not sure what else to try. My bundle name is in this format: net.company.MyApp and I have entered it exactly that way into the Google Cloud Console (I know bundle IDs are case-sensitive).

可能是Google不支持某种类型的包标识符(例如,使用大写字母或以 net开头。)?

Could it be that Google doesn't support bundle identifiers of a certain type (e.g., with upper-case letters or beginning with net.)?

推荐答案

我发现了这个问题。必须启用Google Maps SDK for iOS才能使密钥生效。我已经启用了Google Maps API v3,我认为这已经足够了,但事实并非如此。

I found the issue. Google Maps SDK for iOS must be enabled for keys to work. I already had Google Maps API v3 enabled and I thought that was enough, but it wasn't.

这篇关于Google Maps iOS API密钥无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆