App is crashing on a map screen when it open and close several times. (Mostly on 6th attempt)
Class that inherits from GMSMapView
class AirportMapView: GMSMapView , AirportMapViewProtocol{
weak var airportMapViewModuleDelegate: AirportMapViewModuleProtocol?
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override init(frame: CGRect) {
super.init(frame: frame)
}
convenience init(from frame: CGRect, with cameraPosition: GMSCameraPosition) {
self.init(frame: frame)
self.camera = cameraPosition
}
func setCluster() {
let algorithm = CustomGoogleMapsClusteringAlgorithm.init();
mapIconGenerator = VJAirportIconGrayClusterGenerator.init()
let renderer = VJGoogleMapsClusterRenderer(mapView: self,
clusterIconGenerator: mapIconGenerator!)
clusterManager = GMUClusterManager.init(map: self, algorithm: algorithm, renderer: renderer)
clusterManager?.setDelegate(self, mapDelegate: self)
}
}
In ViewController viewDidLoad
I am calling init
method of mapView
self.mapView = [[AirportMapView alloc] initFrom:frame with:camera];
self.mapView.myLocationEnabled = YES;
self.mapView.settings.compassButton = YES;
self.mapView.settings.zoomGestures = YES;
self.mapView.airportMapViewModuleDelegate = self;
Backtrace of the crash and console logs attached
Observation:
GMUClusterManager
initWithMap
method if I removeaddObserver
code app is not crashing