Our app has quite a lot of crashes happening to users, reported by crashlytics, however we are unable to reproduce it on our end. Here is the full crash report:
Crashed: com.apple.main-thread
0 TheBarCode 0x100ccc2d8 gmscore::renderer::GLState::Flush() + 16388
1 TheBarCode 0x100cd7630 gmscore::renderer::GLScopedContext::~GLScopedContext() + 31600
2 TheBarCode 0x100d3a314 -[GMSEntityRendererView setFrame:] + 436308
3 TheBarCode 0x100d82578 -[GMSVectorMapView setFrame:] + 184912
4 UIKitCore 0x18f6af878 -[UIView(Geometry) _applyAutoresizingMaskWithOldSuperviewSize:] + 576
5 UIKitCore 0x18f6b0510 -[UIView(Geometry) _resizeWithOldSuperviewSize:] + 236
6 CoreFoundation 0x18b18195c __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 16
7 CoreFoundation 0x18b084fb0 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 416
8 UIKitCore 0x18f6af5e4 -[UIView(Geometry) resizeSubviewsWithOldSize:] + 156
9 UIKitCore 0x18f6b082c -[UIView(Geometry) setBounds:] + 688
10 UIKitCore 0x18f6b00e0 -[UIView(Geometry) _applyISEngineLayoutValuesToBoundsOnly:] + 528
11 UIKitCore 0x18f6b04ac -[UIView(Geometry) _resizeWithOldSuperviewSize:] + 136
12 CoreFoundation 0x18b18195c __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 16
13 CoreFoundation 0x18b084fb0 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 416
14 UIKitCore 0x18f6af5e4 -[UIView(Geometry) resizeSubviewsWithOldSize:] + 156
15 UIKitCore 0x18f5f76fc -[UIView(AdditionalLayoutSupport) _is_layout] + 148
16 UIKitCore 0x18f6b7090 -[UIView(Hierarchy) _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 1032
17 Gradientable 0x101738798 UIView.swizzled_layoutSubviews() + 50 (Gradientable.swift:50)
18 Gradientable 0x1017388d0 @objc UIView.swizzled_layoutSubviews() + 4359784656 (<compiler-generated>:4359784656)
19 UIKitCore 0x18f6ca17c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2140
20 QuartzCore 0x191c322c0 -[CALayer layoutSublayers] + 284
21 QuartzCore 0x191c3843c CA::Layer::layout_if_needed(CA::Transaction*) + 480
22 QuartzCore 0x191c43140 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 136
23 QuartzCore 0x191b8b884 CA::Context::commit_transaction(CA::Transaction*, double) + 304
24 QuartzCore 0x191bb5574 CA::Transaction::commit() + 676
25 QuartzCore 0x191bb5f68 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
26 CoreFoundation 0x18b12be68 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
27 CoreFoundation 0x18b126d54 __CFRunLoopDoObservers + 416
28 CoreFoundation 0x18b127320 __CFRunLoopRun + 1308
29 CoreFoundation 0x18b126adc CFRunLoopRunSpecific + 464
30 GraphicsServices 0x1950c7328 GSEventRunModal + 104
31 UIKitCore 0x18f23463c UIApplicationMain + 1936
32 TheBarCode 0x10082756c main + 21 (Preference.swift:21)
33 libdyld.dylib 0x18afb0360 start + 4
The other strange thing is that we are not receiving any additional added (on which screen does it happen) logs along with the crash.
Additional Information:
Recently we have upgraded our application for iOS 13 and xcode 11. By doing so, we have also updated google maps iOS SDK to 3.8.0. After upgrading we are receiving crash reports. On the previously used version we never experienced this crash i.e. 2.7.0
In our application we have multiple instances of GMSMapView i.e. around 8 instances embedded in a UIPageViewController. For the sake of memory management we only keep the visible version of GMSMapView and discard other instances in viewDidDisappear method of view controller. Here is the code that we are using to setup map and clearing map.
func setupMapView() {
let mapView = GMSMapView(frame: CGRect.zero)
mapView.settings.allowScrollGesturesDuringRotateOrZoom = false
if CLLocationManager.authorizationStatus() != .notDetermined {
mapView.settings.myLocationButton = false
mapView.isMyLocationEnabled = true
self.myLocationButtonContainer.isHidden = false
} else {
self.myLocationButtonContainer.isHidden = true
}
self.mapContainer.insertSubview(mapView, at: 0)
mapView.autoPinEdgesToSuperviewEdges()
let iconGenerator = GMUCustomClusterIconGenerator()
let algorithm = GMUNonHierarchicalDistanceBasedAlgorithm()
let renderer = GMUDefaultClusterRenderer(mapView: mapView, clusterIconGenerator: iconGenerator)
renderer.delegate = self
self.clusterManager = GMUClusterManager(map: mapView, algorithm: algorithm, renderer: renderer)
self.clusterManager?.setDelegate(self, mapDelegate: self)
self.mapView = mapView
self.setUpMarkers()
self.restoreMapCameraPosition(animated: false)
}
func clearMapView() {
self.clusterManager?.clearItems()
self.mapView?.clear()
self.mapView?.removeFromSuperview()
self.mapView = nil
self.clusterManager = nil
}
Screenshots from crashlytics:
Screenshot from the data tab of crashlytics:

