GoogleMaps (GMSView) Won't display in iOS
Asked Answered
L

6

28

I have incorporated the following:

  1. Tried importing both the GoogleMaps/GoogleMaps.h as well as the GoogleMapsM4B/GoogleMaps.h files through an Obj-C Bridging Header
  2. Manually typed out the iOS API key in my AppDelegate.swift (didFinishLaunchingWithOptions) method.
  3. Cleaned the project (command+shift+k)
  4. Closed/relaunched Xcode
  5. Uninstalled/reinstalled Xcode

And pretty much everything else other people have suggested. I have spent two days straight trying to fix this problem. Does anyone know a solution to this problem?

The console complaint is:

> "2015-08-17 18:02:19.899 Project[608:10014] ClientParametersRequest
> failed, 3 attempts remaining (0 vs 6). Error
> Domain=com.google.HTTPStatus Code=400 "The operation couldn’t be
> completed. (com.google.HTTPStatus error 400.)" UserInfo=0x790bc050
> {data=<CFData 0x7925cb40 [0x22da9a8]>{length = 145, capacity = 256,
> bytes = 0x3c48544d4c3e0a3c484541443e0a3c54 ... 3c2f48544d4c3e0a}}
> 2015-08-17 18:02:19.899 randoPracty[608:10014] Google Maps SDK for iOS
> (M4B) version: 1.10.17867.0 2015-08-17 18:02:19.959
> randoPracty[608:10014] ClientParametersRequest failed, 2 attempts
> remaining (0 vs 6). Error Domain=com.google.HTTPStatus Code=400 "The
> operation couldn’t be completed. (com.google.HTTPStatus error 400.)"
> UserInfo=0x7925cf40 {data=<CFData 0x79187b20 [0x22da9a8]>{length =
> 145, capacity = 256, bytes = 0x3c48544d4c3e0a3c484541443e0a3c54 ...
> 3c2f48544d4c3e0a}} 2015-08-17 18:02:24.406 randoPracty[608:10014]
> ClientParametersRequest failed, 1 attempts remaining (0 vs 6). Error
> Domain=com.google.HTTPStatus Code=400 "The operation couldn’t be
> completed. (com.google.HTTPStatus error 400.)" UserInfo=0x790f4c60
> {data=<CFData 0x786e5610 [0x22da9a8]>{length = 145, capacity = 256,
> bytes = 0x3c48544d4c3e0a3c484541443e0a3c54 ... 3c2f48544d4c3e0a}}
> 2015-08-17 18:02:32.797 randoPracty[608:10014] ClientParametersRequest
> failed, 0 attempts remaining (0 vs 6). Error
> Domain=com.google.HTTPStatus Code=400 "The operation couldn’t be
> completed. (com.google.HTTPStatus error 400.)" UserInfo=0x7925b390
> {data=<CFData 0x790f3760 [0x22da9a8]>{length = 145, capacity = 256,
> bytes = 0x3c48544d4c3e0a3c484541443e0a3c54 ... 3c2f48544d4c3e0a}}
> 2015-08-17 18:02:32.797 randoPracty[608:10014] 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=0x7925b390
> {data=<CFData 0x790f3760 [0x22da9a8]>{length = 145, capacity = 256,
> bytes = 0x3c48544d4c3e0a3c484541443e0a3c54 ... 3c2f48544d4c3e0a}}
> 2015-08-17 18:02:32.798 randoPracty[608:10014] Your key may be invalid
> for your bundle ID: com.User.ProjectName"
Lanti answered 17/8, 2015 at 15:37 Comment(3)
Refer #32043784Caldarium
I had the same problem. Resolved it with this solution: https://mcmap.net/q/503116/-google-maps-ios-api-key-not-working (Google Maps SDK for iOS must be enabled for keys to work)Britt
Just Check this Google Maps SDK for iOS must be enabled, Bundle ID must be same. finally just clean your project . It Worked for me.Mauchi
C
28

I too faced the same problem. First of all follow the steps below.

  1. Have all the steps mentioned in this link been followed by you?

  2. Though you are unable to get through, check your Bundle Identifier is matching with the one you used to create the key.

If everything is well and good, the problem is with the framework. Initially I too used the GoogleMapsM4B framework which didn't work for me. I downloaded the other framework which works fine for me from this link.

Add the new framework (GoogleMaps.framework) and remove the GoogleMapsM4B framework from the project. This solved my problem. Hope this helps you.

EDIT:

From version 1.10.0 onwards, the framework installation is supported only via cocoapods. And all zip downloads were removed for previous versions. Read "Migration from 1.9.2 or earlier:" section under "Version 1.10.0 - May 2015" in this link.

Cent answered 19/8, 2015 at 11:12 Comment(6)
I tried to find a download with that link. I have no luck.Bickerstaff
From version 1.10.0 onwards, the framework installation is supported only via cocoapods. And all zip downloads were removed for previous versions. Read "Migration from 1.9.2 or earlier:" section under "Version 1.10.0 - May 2015" in that link.Cent
+100 for the well explained and simple answer, Mine was the bundle identifierDurman
Check bundle ID and clean your project . Just do it ,This worked for me like a magic :Mauchi
Thanks. The key for me was simply removing GoogleMapsM4B. After that, everything worked. I'm actually integrating both Maps and Places using Carthage via (github.com/leoneparise/GoogleMaps-Carthage & the Places project) and thought that might be the problem, but it was just removing the M4B.Triumphant
Another case of the M4B here, their documentation (developers.google.com/maps/premium/ios-get-started) explicitly says to Premium plan users to add it, so maybe it does not work with normal keys at all. >> Premium Plan customers must also add: pod 'GoogleMaps/M4B'Providenciaprovident
S
38

Just enable "Google Maps SDK for iOS" for your project in Google Developers Console.

Shake answered 10/3, 2016 at 21:2 Comment(2)
Thanks I forgot this one !Decisive
Awesome. Looks likes Places and Maps are two separated SDKs. Cheers!Keratitis
C
28

I too faced the same problem. First of all follow the steps below.

  1. Have all the steps mentioned in this link been followed by you?

  2. Though you are unable to get through, check your Bundle Identifier is matching with the one you used to create the key.

If everything is well and good, the problem is with the framework. Initially I too used the GoogleMapsM4B framework which didn't work for me. I downloaded the other framework which works fine for me from this link.

Add the new framework (GoogleMaps.framework) and remove the GoogleMapsM4B framework from the project. This solved my problem. Hope this helps you.

EDIT:

From version 1.10.0 onwards, the framework installation is supported only via cocoapods. And all zip downloads were removed for previous versions. Read "Migration from 1.9.2 or earlier:" section under "Version 1.10.0 - May 2015" in this link.

Cent answered 19/8, 2015 at 11:12 Comment(6)
I tried to find a download with that link. I have no luck.Bickerstaff
From version 1.10.0 onwards, the framework installation is supported only via cocoapods. And all zip downloads were removed for previous versions. Read "Migration from 1.9.2 or earlier:" section under "Version 1.10.0 - May 2015" in that link.Cent
+100 for the well explained and simple answer, Mine was the bundle identifierDurman
Check bundle ID and clean your project . Just do it ,This worked for me like a magic :Mauchi
Thanks. The key for me was simply removing GoogleMapsM4B. After that, everything worked. I'm actually integrating both Maps and Places using Carthage via (github.com/leoneparise/GoogleMaps-Carthage & the Places project) and thought that might be the problem, but it was just removing the M4B.Triumphant
Another case of the M4B here, their documentation (developers.google.com/maps/premium/ios-get-started) explicitly says to Premium plan users to add it, so maybe it does not work with normal keys at all. >> Premium Plan customers must also add: pod 'GoogleMaps/M4B'Providenciaprovident
I
8

I had the same problem. In my case it was, that I had to manually activate the Google Maps SDK for iOS and Google Places SDK for iOS in the Overview section of Googles API Library.

The steps how to activate it are:

  1. Go to the Overview page in the API Library.
  2. Choose here Google Maps SDK for iOS and Google Places SDK for iOS.

enter image description here

  1. Choose at the top left, the second item. On the screenshot it's now enabled. Before it was disabled.

enter image description here

Maybe this helps someone as well.

Kind regards Matt

Implead answered 15/5, 2016 at 8:23 Comment(1)
Thanks mate, for the visual instruction. It did work for me and fixed my issue!Chambers
C
3

Can you update your question to provide any more details? (xcode version, Google Maps Framework version, etc)

  1. Double check that your API key is valid for your bundle id on console.developer.google.com
  2. When running, check and see if any SSL errors are occurring in the console. In my case, I was having certificate problems with Google, and this interfered with my map tiles loading.
  3. Make sure you only have either the M4B framework OR the normal framework in your project. If you include both, I am pretty sure they are conflicting with each other.

Hope this helps out; it just randomly started working correctly in my case.

Celestyn answered 17/8, 2015 at 15:52 Comment(1)
My Xcode version is currently 6.4, the Google Maps framework version is GoogleMapsM4B-iOS-1.10.1... On console.developer.google.com my API key seems to be valid for my bundle id (no issues there). I added in the error to my question.Lanti
M
1

Check the Bundle identifier specified in the Xcode project target setting and the google project page where you created the google API key. both should match otherwise GMSServices.provideAPIKey(googleMapsAPiKey) will pass but you will get connection error

The operation couldn’t be completed. (com.google.HTTPStatus error 400.)

Mook answered 30/3, 2016 at 16:8 Comment(0)
I
1

I faced this problem too and after an hour of Googling and juggling on #SO, I have come to know this little mistake:

If you have changed your API key (somewhere during the development)

[GMSPlacesClient provideAPIKey:@"YOUR_API_KEY"];

which you add to your didFinishLaunchingWithOptions: method in your AppDelegate.m file. Make sure it is the same as you used to activating the Google Places API here

Hope this may help to someone after trying every solution.

Impatient answered 23/2, 2018 at 7:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.