Google Directions API未能在iOS中返回结果

时间:2014-10-04 17:27:28

标签: ios api google-maps ios8 directions

我正在尝试使用Google Directions API。我已经设置了SDK。我在开发者控制台的服务下启用了 Google Maps SDK for iOS 。以下是我为获取路线而建立的网址。

开发者控制台中有两种类型的键。

enter image description here

首先,我尝试使用Key for iOS应用程序。

https://maps.googleapis.com/maps/api/directions/json?origin=-37.814107,144.96328&destination=-31.953004,115.857469&key=<Key for iOS apps>

但我收到错误此IP,网站或移动应用程序无权使用此API密钥

当我搜索此错误的解决方案时,我在一些StackOverflow答案(12)中看到,不支持iOS密钥。在答案中,他们谈论的是Google Places API,但我认为这可能与Directions相同,因为错误是相同的。

所以我用浏览器应用程序的键替换了 iOS应用程序的 并再次运行但我收到了一个新错误此API项目未获得授权使用此API。请确保在API控制台中激活此API

我的问题是,我必须在服务中激活任何其他API以使其正常工作吗?这些是列表中与地图相关的其他Google API。

enter image description here

2 个答案:

答案 0 :(得分:3)

API“Google Maps SDK for iOS” - 仅用于集成“Google Maps SDK”...

如果您想“使用”路线..您必须在Google控制台中“激活”:“Directions API”,developers.google.com/maps/documentation/directions

快乐的编码!

答案 1 :(得分:1)

你正在使用吗? https://developers.google.com/maps/documentation/ios/那里还有一个很好的文档。 是的,您需要在登录时在google api中心激活IOS Maps SDK