简体   繁体   English

Google地图背景为灰色

[英]Google maps background is gray

If you're like me, you might be searching all of the internet to fix this problem. 如果您像我一样,则可能正在整个互联网上搜索以解决此问题。 Every post will be saying 每个帖子都会说

If you have a gray background it's your API key 如果背景为灰色,则是您的API密钥

but we thought we were special. 但是我们认为我们很特别。 Even our 甚至我们的

GMSServices.provideAPIKey("YOUR_API_KEY")

was returning with True . 带着True返回。

We checked that: 我们检查了:

  • our API key was the iOS key 我们的API密钥是iOS密钥
  • that google maps was enabled 谷歌地图已启用
  • that the key matched what was on the console 该键与控制台上的键匹配
  • our bundle identifier was correct 我们的捆绑包标识符正确

Nothing worked. 没事。

We stored out API key in a file, so we could add it to our .gitignore . 我们将API密钥存储在文件中,因此可以将其添加到.gitignore Turns out when you're reading in your API key you're going to want to be absolutely sure that you're trimming \\n s from your string. 事实证明,当您阅读API密钥时,您将要绝对确定要从字符串中修剪\\n

I hope this helps at least one other person! 我希望这可以帮助至少另一个人!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM