1

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

Arvinder Singh
  • 109
  • 1
  • 12
  • Are you calling [GMSServices provideAPIKey:@""]; before trying to use the services? – Vijay Tholpadi Jun 19 '15 at 07:54
  • I have downloaded demo code from google map sdk and i have not changed anything and yes this function is being called. – Arvinder Singh Jun 19 '15 at 11:27
  • 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 Jun 19 '15 at 11:30

4 Answers4

0

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.

Vijay Tholpadi
  • 2,135
  • 1
  • 15
  • 20
  • Thanks for the reply but demo code wont run directly. It has build error. First i created an API Key and replaced key in code and still i got the error. Also Bundle id is the same. – Arvinder Singh Jun 19 '15 at 12:06
  • What error are you seeing? Did you happen to resolve it? – Vijay Tholpadi Jun 19 '15 at 12:07
  • 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 – Arvinder Singh Jun 19 '15 at 12:09
  • Mind sharing the example code. Could try checking it for you. – Vijay Tholpadi Jun 19 '15 at 12:16
  • Here below in didFinishLaunchingWithOptions if ([kAPIKey length] == 0) { // Blow up if APIKey has not yet been set. NSString *bundleId = [[NSBundle mainBundle] bundleIdentifier]; NSString *format = @"Configure APIKey inside SDKDemoAPIKey.h for your " @"bundle `%@`, see README.GoogleMapsSDKDemos for more information"; @throw [NSException exceptionWithName:@"SDKDemoAppDelegate" reason:[NSString stringWithFormat:format, bundleId] userInfo:nil]; } [GMSServices provideAPIKey:kAPIKey]; – Arvinder Singh Jun 19 '15 at 12:22
  • you mean whole zip file? – Arvinder Singh Jun 19 '15 at 12:23
  • https://developers.google.com/maps/documentation/business/mobile/ios/ you can see download link when you will open above link – Arvinder Singh Jun 19 '15 at 12:31
0

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

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

Community
  • 1
  • 1
rameez
  • 374
  • 2
  • 11
0

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.

Akash KR
  • 778
  • 3
  • 11