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 UIControl
s 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.
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.
You can remove a marker from the map by setting the map property of the GMSMarker to nil .
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'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With