Google Maps API 警告:NoApiKeys [英] Google Maps API warning: NoApiKeys

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

问题描述

我在没有 API 密钥的情况下使用 Google Maps API v3 已经有一段时间了,它运行良好.
它仍然有效,但我在控制台中收到警告:

I've been using Google Maps API v3 for some time without an API key, and it worked well.
It still works, but I get a warning in the console:

Google Maps API 警告:NoApiKeyshttps://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys

Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys

我以标准方式包含脚本:

I include the script the standard way:

<script src="https://maps.googleapis.com/maps/api/js?libraries=places"></script>

并且 google.maps.version 表示我使用的是 3.24.2.

And google.maps.version indicates that I'm using 3.24.2.

在 Google 文档中,我只能看到获取密钥的不同方法,但没有说明是否需要.我今天注意到警告,我很确定它几周前没有出现.

In the Google documentation I can only see the different ways to obtain a key, but there is no indication if it's required or not. I noticed the warning today and I'm quite sure it didn't appear a few weeks ago.

目前一切正常,但我担心没有 API 密钥的地图访问将来会停止.如果我不是绝对需要,我不愿意注册密钥.

Everything is working fine for now, but I'm afraid that maps access without an API key will be ceased in the future. I'm reluctant to register for a key if I don't absolutely need to.

我应该担心吗?

推荐答案

创建和使用密钥是必经之路.在您的应用程序连续 90 天达到每天 25.000 次调用之前,该使用是免费的.

Creating and using the key is the way to go. The usage is free until your application reaches 25.000 calls per day on 90 consecutive days.

顺便说一句:在谷歌开发者文档中,它说在调用 API 以创建新实例时,您应该将 api 密钥添加为选项 {key:yourKey}.然而,这并没有消除控制台警告.包含api时必须将key作为参数添加.

BTW.: In the google Developer documentation it says you shall add the api key as option {key:yourKey} when calling the API to create new instances. This however doesn't shush the console warning. You have to add the key as a parameter when including the api.

<script src="https://maps.googleapis.com/maps/api/js?key=yourKEYhere"></script>

在此处获取密钥:GoogleApiKey生成站点

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

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