Search code examples
iosgoogle-mapsgoogle-maps-sdk-ios

iOS ,Google Map Error: Your key may be invalid for your bundle ID


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=0x7f95f4811190 
{data=<CFData 0x7f95f24df240 [0x1030a2eb0]>
{length = 145, capacity = 256,bytes =     
0x3c48544d4c3e0a3c484541443e0a3c54... 3c2f48544d4c3e0a}}

I need help with this error.


Solution

  • You need to provide an API KEY for your application. You can follow the steps in this documentation to create an API_KEY from Google Developer Console. (note: the sample API_KEY in the documentation page will probably throw the error, so dont use it, create your own one)

    After you get the API KEY from your developer console, you can paste it in the AppDelegate file.

    If you are developing an Objective-C app, do this:

    [GMSServices provideAPIKey:@"YOUR_API_KEY"];
    

    If you are developing a Swift app, do this:

    GMSServices.provideAPIKey("YOUR_API_KEY");
    

    (replace YOUR_API_KEY with your actual key).