1
votes

I downloaded the google map IOS sdk and then i crated the project from https://console.developers.google.com and then i created an API key.

Also i added the bundle identifier of the demo app in SDK.

But everytime i am running the app i am getting this error.

Google Maps SDK for iOS (M4B) cannot connect or validate APIKey: Error Domain=com.google.HTTPStatus Code=400 "The operation couldn’t be completed. (com.google.HTTPStatus error 400.)" UserInfo=0x15f04e00 {data={length = 145, capacity = 256, bytes = 0x3c48544d4c3e0a3c484541443e0a3c54 ... 3c2f48544d4c3e0a}}

Your key may be invalid for your bundle ID

I created the key multiple times and also checked the bundle identifier but they are correct. So i am not able to figure out what exactly i am doing wrong.

Please let me know if any one can help regarding this.

Regards, Arvinder

4
Are you calling [GMSServices provideAPIKey:@"<YOUR API KEY HERE>"]; before trying to use the services? - Vijay Tholpadi
I have downloaded demo code from google map sdk and i have not changed anything and yes this function is being called. - Arvinder Singh
You need to change the code to enter your API key. The one in the demo code will not work. Search for GMSServices provideAPIKey: and put the iOS API key that you have generated in your developer console. - Vijay Tholpadi

4 Answers

0
votes

Make sure that you have the generated key for your iOS app in the developer console in the line

[GMSServices provideAPIKey:@"<INSERT API KEY HERE>"];

The error seems to complain that you are having an invalid Key which might be your case as you are directly trying to run demo code that you have downloaded. Example code do not usually contain valid keys as it can be misused by anyone else or exhaust the original authors API-call limits.

Also make sure that you have entered/authorized your current app's bundle id to use this API Key when you have generated it in your Google developer console.

0
votes

First Create key for ios device from here

copy your bundle id form project so there is no chance for mistake

https://console.developers.google.com/project/plated-courier-95607/apiui/credential#pending_key

after that clean xcode , reset simulator ,close xcode ,open project run again it definitely going to work

0
votes

you need to use the framework. Please find the instructions to download it via cocoa pods on the answer given by me on this link : not able to use Google map sdk in ios

0
votes

I also faced the same issue. Actually the problem is Google M4B Framework comes under premium plan. You need to purchase it from the Google's Developer Portal because it provides some new classes like GMSAutoComplete, GMSAutoPredict etc.

You should rather use Google Standard Framework. It will run completely fine. Also you will not find some classes that come under Google M4B(only 5 new classes). Implement the required steps and have fun.