3

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.

enter image description here

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.

enter image description here

Community
  • 1
  • 1
Isuru
  • 30,617
  • 60
  • 187
  • 303
  • if you want to “use” Directions.. you have to “activate” in the Google console: "Directions API” , too https://developers.google.com/maps/documentation/directions/ – TonyMkenu Oct 04 '14 at 21:12
  • 1
    @TonyMkenu That's it! Now its working. Can't believe I missed that! Thank you. If you can post it as an answer, I can accept it. – Isuru Oct 05 '14 at 05:56

2 Answers2

3

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!

TonyMkenu
  • 7,597
  • 3
  • 27
  • 49
1

Are you using https://developers.google.com/maps/documentation/ios/ also there is a nice documentation there. Yes you need to activate the IOS Maps SDK in the google api center when you log in

Stefan van de Laarschot
  • 2,154
  • 6
  • 30
  • 50
  • Yes that's the documentation I'm following. And yes, I have already enabled the Google Maps for iOS SDK API. Are there any other APIs I have to activate out of [these](http://i.imgur.com/OzSsq0R.png)? – Isuru Oct 04 '14 at 18:43