Google Maps for iOS不显示地图 [英] Googlemap for iOS not show map

查看:193
本文介绍了Google Maps for iOS不显示地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的iOS应用中集成Google地图



1.生成的API密钥

2.为iOS应用定义关键限制和应用程序包ID

3.添加了pod

4.在我的AppDelegate中定义了api密钥为

 func application(_ application:UIApplication,didFinishLaunchingWithOptions launchOptions:[UIApplicationLaunchOptionsKey:Any]?) - > Bool {
//在应用程序启动后覆盖自定义点。
UIApplication.shared.statusBarStyle = .lightContent
GMSServices.provideAPIKey(AIzaSyA8D1awYfmGSQuhmtY_TSqtafUXMtQjeuk)
返回true
}



5.启动应用程序并查看空地图视图。



在日志中我看到:

引用:



2017-06-16 19:15:27.842 {app name} [12134:333695] Google Maps SDK for iOS无法连接或验证APIKey:错误域= com.google.HTTPStatus代码= 400 (空) 的UserInfo = {数据= LT; 3c48544d 4c3e0a3c 48454144 3e0a3c54 49544c45 3e426164 20526571 75657374 3c2f5449 544c453e 0a3c2f48 4541443e 0a3c424f 44592042 47434f4c 4f523d22 23464646 46464622 20544558 30303030 543d2223 3030223e 0a3c4831 3e426164 20526571 75657374 3c2f4831 3e0a3c48 323e4572 726f7220 3430303c 2f48323e 0a3c2f42 4f44593e 0a3c2f48 544d4c3e 0a>}



2017-06-16 19:15:27.842 {app name} [12134:333695]你的钥匙可能是对于您的软件包ID无效:{bundle id}



我忘了做什么?



我尝试了什么:



我检查了我的应用程序包ID,它是正确的(从Xcode复制粘贴)

解决方案

我忘了在google开发者控制台中启用Google Maps iOS SDK。


Integrated Google maps in my iOS app

1. generated API key
2. defined key restriction for iOS app and app bundle ID
3. added pod
4. defined api key in my AppDelegate as

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        UIApplication.shared.statusBarStyle = .lightContent
        GMSServices.provideAPIKey("AIzaSyA8D1awYfmGSQuhmtY_TSqtafUXMtQjeuk")
        return true
    }


5. launch app and see empty map view.

In log I see this:

Quote:


2017-06-16 19:15:27.842 {app name}[12134:333695] Google Maps SDK for iOS cannot connect or validate APIKey: Error Domain=com.google.HTTPStatus Code=400 "(null)" UserInfo={data=<3c48544d 4c3e0a3c 48454144 3e0a3c54 49544c45 3e426164 20526571 75657374 3c2f5449 544c453e 0a3c2f48 4541443e 0a3c424f 44592042 47434f4c 4f523d22 23464646 46464622 20544558 543d2223 30303030 3030223e 0a3c4831 3e426164 20526571 75657374 3c2f4831 3e0a3c48 323e4572 726f7220 3430303c 2f48323e 0a3c2f42 4f44593e 0a3c2f48 544d4c3e 0a>}

2017-06-16 19:15:27.842 {app name}[12134:333695] Your key may be invalid for your bundle ID: {bundle id}



What did I forget to do?

What I have tried:

I checked my app bundle id, it is correct (copy-pasted from Xcode)

解决方案

I forgot enable Google Maps iOS SDK in google developer console.


这篇关于Google Maps for iOS不显示地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆