my app has initial search screen and on search goes to maps screen (GMSMapView
) in navigation, after multiple to and fro transitions app crashes without error and some times with error
* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '{id: 31684}: An -observeValueForKeyPath:ofObject:change:context: message was received but not handled. Key path: camera Observed object: ; layer = > Change: { kind = 1; new = "GMSCameraPosition 0x149091040: target:(51.179, -1.826) bearing:0.000 zoomLevel:4.000 viewingAngle:0.000"; } Context: 0x0' * First throw call stack: (0x183326d8c 0x1824e05ec 0x183326c6c 0x183d39e5c 0x183cb52f8 0x183cb4e30 0x183d39ca0 0x101296d34 0x101294fbc 0x101293fe0 0x18d569edc 0x18d6cb628 0x18d6cb360 0x18d569b84 0x18d6cb628 0x18d6cb7a0 0x18d6cb360 0x18d568ed4 0x18d39aadc 0x18cfde0f0 0x18cf02b90 0x18cf02acc 0x18d2403b4 0x18cfafac8 0x18cfaf720 0x18cfa3424 0x18cefb770 0x18749d25c 0x1874a13ec 0x18740daa0 0x1874355d0 0x187436450 0x1832ce910 0x1832cc238 0x1832cc884 0x1831ecda8 0x1851cf020 0x18d1cd78c 0x100d953a8 0x182c7dfc0) libc++abi.dylib: terminating with uncaught exception of type NSException
Here is my mapView screen code
func createMap()
{
mapView.delegate = self
mapView.isMyLocationEnabled = true
mapView.settings.scrollGestures = true
mapView.settings.zoomGestures = true
mapView.settings.compassButton = true
mapView.padding = UIEdgeInsetsMake (0,0,0,0)
mapView.settings.myLocationButton = true
mapView.isHidden = true
}
Here is viewWillDisappear
code in mapview
screen
override func viewWillDisappear(_ animated: Bool)
{
super.viewDidDisappear(true)
// Remove Advertisemnt
appDelegate.removeAdsFromViewController(controller: self)
NotificationCenter.default.removeObserver(self)
self.clusterManager.clearItems()
self.mapView.clear()
}