我正在开发一个简单的iOS应用程序,并将Google Maps集成到其中。但是我没有得到任何结果。我使用了以下步骤:
步骤1:从sdk ios链接下载Google Maps Mobile SDK。
步骤2:在Google APIs控制台中创建一个API项目。
步骤3:在您的API项目中选择服务窗格,并启用iOS Google Maps SDK。这将显示Google Maps服务条款。
获取Google APIs控制台的“Active”状态。
步骤4:在控制台中选择API访问窗格,然后单击“创建新的iOS键”。
然后,我像这样在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
有人能帮忙找出错误吗?这里缺少什么?不明白为什么会出现这个错误。这是运行应用程序后模拟器的屏幕截图。