Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS app freezes when loading custom info window for marker on Google Maps

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.)

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

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.

The CustomInfoWindow.swift file basically looks like:

import UIKit
class CustomInfoWindow: UIView {}

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
}

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

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.

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.

What can the problem be?

UPDATE: This issue occurred on version 1.13 of the Google Maps SDK for iOS and it turned out to be a bug on that version.

like image 450
Stanley Avatar asked Apr 20 '16 14:04

Stanley


People also ask

Why does Google Maps freeze on my Iphone?

If the Google Maps app on your phone or tablet crashes or has other issues that affect your experience on Maps, try the following steps: Update Google Maps. Clear storage in the Settings app on your device.

How do I remove a marker from Google Maps on Iphone?

You can remove a marker from the map by setting the map property of the GMSMarker to nil .


1 Answers

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

You can use:

pod 'GoogleMaps', '1.12.3'
like image 94
kolesnikovakate Avatar answered Oct 27 '22 00:10

kolesnikovakate