Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
608 views
in Technique[技术] by (71.8m points)

objective c - not able to use Google map sdk in ios

I am working a simple iOS app into which I am integrating Google Maps. but not getting any result . i have used this steps

step 1:i have downloaded Google Maps Mobile SDK from this link sdk ios

step 2: Create an API project in the Google APIs Console.

step 3: Select the Services pane in your API project, and enable the Google Maps SDK for iOS. This displays the Google Maps Terms of Service.

enter image description here getting Active status Google APIs Console. enter image description here step 4:i Selected the API Access pane in the console, and click Create new iOS key.

enter image description here

and then i added API Key in AppDelegate.m like this

#import "AppDelegate.h"
#import <GoogleMapsM4B/GoogleMaps.h>
@interface AppDelegate ()

@end

@implementation AppDelegate


    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        // Override point for customization after application launch.

        NSLog(@"Current identifier: %@", [[NSBundle mainBundle] bundleIdentifier]);
        [GMSServices provideAPIKey:@"AIzaSTyurcyzpvoRv3gCPJRiw7Dc6dXkTMfOI2w"];
        return YES;
    }

but i am not getting result. in log i got this error

Gmap[3836:883464] Current identifier: com.example.Gmap
2015-02-06 14:39:41.790 Gmap[3836:883464] Google Maps SDK for iOS (M4B) version: 1.9.13516.0
2015-02-06 14:39:42.014 Gmap[3836:883464] 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=0x7f922a67fcd0 {data=<CFData 0x7f922d4615a0 [0x1049039a0]>{length = 145, capacity = 256, bytes = 0x3c48544d4c3e0a3c484541443e0a3c54 ... 3c2f48544d4c3e0a}}
2015-02-06 14:39:42.213 Gmap[3836:883464] 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=0x7f922a4d7540 {data=<CFData 0x7f922d48dd90 [0x1049039a0]>{length = 145, capacity = 256, bytes = 0x3c48544d4c3e0a3c484541443e0a3c54 ... 3c2f48544d4c3e0a}}
2015-02-06 14:39:46.594 Gmap[3836:883464] 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=0x7f922a6a4a50 {data=<CFData 0x7f922a798c00 [0x1049039a0]>{length = 145, capacity = 256, bytes = 0x3c48544d4c3e0a3c484541443e0a3c54 ... 3c2f48544d4c3e0a}}
2015-02-06 14:39:55.528 Gmap[3836:883464] 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=0x7f922d49fed0 {data=<CFData 0x7f922a6406e0 [0x1049039a0]>{length = 145, capacity = 256, bytes = 0x3c48544d4c3e0a3c484541443e0a3c54 ... 3c2f48544d4c3e0a}}
2015-02-06 14:39:55.529 Gmap[3836:883464] 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=0x7f922d49fed0 {data=<CFData 0x7f922a6406e0 [0x1049039a0]>{length = 145, capacity = 256, bytes = 0x3c48544d4c3e0a3c484541443e0a3c54 ... 3c2f48544d4c3e0a}}
2015-02-06 14:39:55.529 Gmap[3836:883464] Your key may be invalid for your bundle ID: com.example.Gmap

Can someone help to find the mistake here. what is missing here. not able to get why this error is coming .this simulator screen after running apps. enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

As we have already said in the comments, you are using the wrong library - Google Maps SDK for Work iOS (business) but you are trying to generate a Key for Google Maps SDK for iOS (you are using: #import <GoogleMapsM4B/GoogleMaps.h> instead #import <GoogleMaps/GoogleMaps.h>


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...