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 withindidFinishLaunchingWithOptions
- 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.