在Google地图上加载标记的自定义信息窗口时,iOS应用会冻结 [英] iOS app freezes when loading custom info window for marker on Google Maps

查看:88
本文介绍了在Google地图上加载标记的自定义信息窗口时,iOS应用会冻结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在iOS应用上的Google Maps Marker上实现自定义信息窗口。 (正如所做的那样这里这里例如。)

I am trying to implement a custom info window on my Google Maps Marker on an iOS app. (As is done here and here for example.)

我创建了一个xib和一个 UIView 类吧。它被称为 CustomInfoWindow.xib ,类是 CustomInfoWindow.swift

I have created a xib and a UIView class for it. It is called CustomInfoWindow.xib and the class is CustomInfoWindow.swift.

我的自定义信息窗口目前是空白的,即我还没有向我的xib添加任何 UIControl 。我还没有在我的类文件中添加任何代码。

My Custom Info Window is currently blank, i.e. I have not yet added any UIControls to my xib. I have also not yet added any code to my class file.

CustomInfoWindow.swift 文件基本上如下:

import UIKit
class CustomInfoWindow: UIView {}

在我的ViewController中,我的 markerInfoWindow 方法如下:

In my ViewController for my maps my markerInfoWindow method is as follows:

func mapView(mapView: GMSMapView!, markerInfoWindow marker: GMSMarker!) -> UIView! {
    let customInfoWindow = NSBundle.mainBundle().loadNibNamed("CustomInfoWindow", owner: self, options: nil)[0] as! CustomInfoWindow

    return customInfoWindow
}

当我运行代码时然后我点击我的一个标记,空白 CustomInfoWindow 显示正常。

When I run the code and I click on one of my markers, the blank CustomInfoWindow displays fine.

奇怪的是那一刻我将任何UI元素添加到Interface Builder中的 CustomInfoWindow.xib 并再次运行我的应用程序,然后当我点击应用程序冻结的标记时突然再次运行。 (例如,当我向 CustomInfoWindow.xib添加 UILabel UIImage 。)如果我删除了UI元素,那么空白笔尖在标记上显示正常。

The strange thing is that the moment I add any UI Element to the CustomInfoWindow.xib in the Interface Builder and run my app again then suddenly when I click on a marker the app freezes. (For example when I add a UILabel or a UIImage to the CustomInfoWindow.xib.) If I remove the UI Element then the blank nib displays fine over the marker.

如果我通过将其作为子视图添加来测试我的笔尖一些View Controller然后用我的 UILabel UIImage 加载。但是,当我在 markerInfoWindow 中使用相同的笔尖时,应用会冻结。

If I test my nib by adding it as a subview on some View Controller then it loads fine with my UILabel and UIImage. However, when I use that same nib in the markerInfoWindow the app freezes.

问题是什么?

更新:
此问题发生在适用于iOS的Google Maps SDK的1.13版本中,结果是该版本的错误

推荐答案

我有同样的问题。这是GoogleMaps的错误!
在版本1.13.0中冻结apperrs。

I have the same issue. It's a GoogleMaps's bug! Freezing apperrs in version 1.13.0.

您可以使用:

pod 'GoogleMaps', '1.12.3'

这篇关于在Google地图上加载标记的自定义信息窗口时,iOS应用会冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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