【发布时间】:2015-02-06 09:33:30
【问题描述】:
我正在开发一个简单的 iOS 应用程序,并将 Google 地图集成到该应用程序中。但没有得到任何结果。 我已经使用了这个步骤
第 1 步:我已下载 Google Maps Mobile SDK 从这个链接sdk ios
第 2 步:在 Google API 控制台中创建一个 API 项目。
第 3 步: 在您的 API 项目中选择“服务”窗格,然后启用适用于 iOS 的 Google Maps SDK。这将显示 Google 地图服务条款。
获取活动状态 Google API 控制台。 第 4 步:i 在控制台中选择 API Access 窗格,然后单击 Create new iOS key。
然后我像这样在 AppDelegate.m 中添加 API 密钥
#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;
}
但我没有得到结果。在日志中我得到了这个错误
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
谁能帮忙找出这里的错误。这里缺少什么。无法理解为什么会出现此错误。运行应用程序后此模拟器屏幕。
【问题讨论】:
-
我用过这个。没有得到。请检查我的步骤。@sandhaya
-
重置一次你的模拟器并检查你的bundle id是否与你在api创建时间中提供的相同,否则请生成新的api密钥
-
一步一步来..vikrambahl.com/google-maps-ios-xcode-storyboards ..它对我有用
-
你有没有检查我的问题。当我设置捆绑 ID 时。我已经截屏了。我在nslog中打印了两者都是一样的。
标签: ios objective-c iphone google-maps google-maps-sdk-ios