适用于iOS的Google Maps SDK不显示地图内容 [英] Google Maps SDK for iOS doesn't display map content

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

问题描述

我正在使用适用于iOS的Google Maps SDK的当前版本1.1.2。地图仅显示Google徽标,当前位置和添加的标记。但是没有任何地图内容:

I'm using the current version 1.1.2 of Google Maps SDK for iOS. The map only displays the Google logo, the current location and the added marker. But no map content whatsoever:

我正确注册了API密钥:

I correctly registered the API key:

BOOL result = [GMSServices provideAPIKey:@"<my key>"];

结果是我验证了bundleIdentifier与API控制台匹配。我从故事板加载GMSMapView并将相机设置在我的 -viewDidLoad 中:

the result is YES and I verified that the bundleIdentifier matches with the API console. I load the GMSMapView from a storyboard and set the camera in my -viewDidLoad:

self.mapView.camera = [GMSCameraPosition cameraWithLatitude:0 longitude:0 zoom:2];

这是由GMSMapView记录的:

This is logged by GMSMapView:

Failed to make complete framebuffer object 8cd6
Failed to make complete framebuffer object 8cd6
Google Maps SDK for iOS version: 1.1.2.2533
GMSZoomTableQuadTree lacks root zoom table for tile type (mapType: 10)
GMSZoomTableQuadTree lacks root zoom table for tile type (mapType: 15)

知道什么可能导致这个问题吗?

Any idea what could cause this problem?

推荐答案

自己找到解决方案。

我正在使用自动布局。显然,在 -viewDidLoad 中,自动布局尚未完成其工作,而我的 GMSMapView 仍然有一个CGRectZero框架。 GMSMapView 似乎对零帧反应非常挑剔。

I'm using Auto Layout. Apparently, in -viewDidLoad the Auto Layout hasn't yet done its work and my GMSMapView still had a CGRectZero frame. GMSMapView seems to react very picky on a zero frame.

[self.view layoutIfNeeded];

在设置相机之前解决了我的问题。

prior to setting the camera solved the problem for me.

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

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