我有一个简单的问题。我正在使用goole map和direction API。所以我需要创建API密钥,这已经完成了。
但是当我编辑API密钥并选择应用程序限制到 iOS应用程序并保存时。
我在我的应用程序中使用此键,然后出现以下错误消息。
该IP,站点或移动应用程序无权使用此API密钥。来自IP地址XXX.XXX.XX.XXX的请求,引荐人为空
但是,如果我从 iOS Apps 中删除了应用程序捆绑包ID,则API密钥有效
我也指的是这个问题This IP, site or mobile application is not authorized to use this API key
但是有些困惑,我们可以保持空白吗?有安全相关的问题吗?要在应用商店上载应用时需要做任何更改吗?
注意:我在编码的所有地方都使用API密钥。像
GMSServices.provideAPIKey(googleAPIKey)
和
let urlString = "https://maps.googleapis.com/maps/api/directions/json?origin=\(myCoordinateStr)&destination=\(destinationCoorinateStr)&key=\(googleAPIKey)&sensor=true"