我有一个带有 cordova 的跨平台应用程序,但现在谷歌地图无法工作。 我有这个错误:
MissingKeyMapError
我尝试在 Google 控制台中使用“*”授权 url 创建新的 api 浏览器 key ,但仍然无法正常工作。我有这个错误:RefererNotAllowedMapError 我的应用程序的window.location.href是:file:///Users/bahri/Library/Developer/CoreSimulator/Devices/757EE924-9884-44B1-BBF5-04CFF3D68C80/data/Containers/Bundle/Application/820BF808- DFF7-4AB0-8BF8-179D278E90D5/com.taxiwink.taxiwinkapp.app/www/index.html
如何解决这个问题?
最佳答案
截至今天(2020 年 7 月 15 日),以下 http 引荐来源网址允许在 cordova 应用程序中显示 Google map :
iOS:
__file_url__//var/containers/Bundle/Application/*
__file_url__//private/var/containers/Bundle/Application/*
(感谢 yannisalexiou 添加了适用于 iOS13 的最后一个)
安卓:
__file_url__//android_asset/www/index.html#/*
__file_url__//android_asset/www/index.html
cordova 模拟(例如:模拟 ios --target=chrome)
127.0.0.1
localhost
引荐来源网址进入 Google Console API 管理(API 项目、凭据、引荐来源网址):
https://console.cloud.google.com/apis/credentials/key/abcxyz?project=api-project-123456
注意:根据 https://github.com/wevote/WeVoteCordova/issues/55 的答案开发
关于google-maps - Cordova 谷歌地图 key API错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37992487/