Google地图在iOS中闪烁 [英] Google Map flickering in iOS

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

问题描述

我在我的应用中通过pod使用Google Maps SDK for iOS版本:1.10.17867.0。但是当我在特定的位置初始化地图时,所有的标题和地图开始闪烁。
示例代码(swift):

 导入UIKit 
导入GoogleMaps

class ViewController:UIViewController {

覆盖func viewDidLoad(){
super.viewDidLoad()
self.view.backgroundColor = UIColor.whiteColor();
var camera = GMSCameraPosition.cameraWithLatitude(19.0176147,经度:72.8561644,缩放:18)
//甚至试试这个:28.6469655,longitude:77.0932634,zoom:10
var mapView = GMSMapView.mapWithFrame (CGRectZero,camera:camera)

var marker = GMSMarker()
marker.position = camera.target
marker.snippet =Hello World
标记。出现动画= kGMSMarkerAnimationPop
marker.map = mapView

self.view = mapView
}
}
$ b $ div class =h2_lin>解决方案

我已经找到了原因。



一个不正确的谷歌地图API密钥,或正确的密钥权限不足,那么这将发生。这是我们的后一个原因。



如需进一步阅读,文档链接,但上述行为在任何地方都没有提及。它应该记录一条错误消息。


I am using Google Maps SDK for iOS version: 1.10.17867.0 in my app via pod. But when I initialise the map at a particular position, all the titles and map starts flickering. Example Code (swift):

import UIKit
import GoogleMaps

class ViewController: UIViewController {

  override func viewDidLoad() {
    super.viewDidLoad()
    self.view.backgroundColor = UIColor.whiteColor();
    var camera = GMSCameraPosition.cameraWithLatitude(19.0176147, longitude: 72.8561644, zoom:18) 
    // even try this: 28.6469655, longitude: 77.0932634, zoom:10 
    var mapView = GMSMapView.mapWithFrame(CGRectZero, camera:camera)

    var marker = GMSMarker()
    marker.position = camera.target
    marker.snippet = "Hello World"
    marker.appearAnimation = kGMSMarkerAnimationPop
    marker.map = mapView

    self.view = mapView
  }
}

解决方案

I have figured out the reason.

If you are using an incorrect google maps api key, or correct key with insufficient permissions, then this will happen. It was the latter reason for us.

For further reading, documentation link, although the said behaviour is not mentioned anywhere. It should rather log an error message.

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

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