Google Directions API 无法在 iOS 中返回结果 [英] Google Directions API failing to return results in iOS

查看:19
本文介绍了Google Directions API 无法在 iOS 中返回结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

开发者控制台中有两种类型的密钥.

首先,我尝试使用适用于 iOS 应用的 Key.

https://maps.googleapis.com/maps/api/directions/json?origin=-37.814107,144.96328&destination=-31.953004,115.857469&key=<iOS应用密钥>

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

当我搜索此错误的解决方案时,我在一些 StackOverflow 答案中看到了 (

快乐编码!

I’m trying to use Google Directions API. I have the SDK all set up. I have enabled Google Maps SDK for iOS under the Services in the developer console. Below is the URL I've built to get the directions.

There are two types of keys in the developer console.

First I tried with the Key for iOS apps.

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

But I got the error This IP, site or mobile application is not authorized to use this API key.

When I searched for a solution to this error I saw in a few StackOverflow answers (1, 2) that iOS keys are not supported. In the answers they're talking about the Google Places API but I thought it might be the same case with Directions because the error was the same.

So I replaces the Key for iOS apps with Key for browser apps and ran it again but I got a new error This API project is not authorized to use this API. Please ensure that this API is activated in the APIs Console.

My question is are there any other APIs I have to activate in the Services to get this working? These are the other map related Google APIs in the list.

解决方案

The API "Google Maps SDK for iOS" - it is only for integrating the "Google Maps SDK"...

If you want to "use" Directions.. you have to "activate" in the Google console: "Directions API" , too developers.google.com/maps/documentation/directions

Happy coding!

这篇关于Google Directions API 无法在 iOS 中返回结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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