Google Maps for iOS不显示地图

编程入门 行业动态 更新时间:2024-10-26 16:26:07
本文介绍了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不显示地图

本文发布于:2023-06-07 22:06:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/568627.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:地图   Google   Maps   iOS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!