Crashlytics 围绕 Maps SDK、gmscore::renderer::GLState::Flush() 的崩溃报告

Muh*_*han 5 ios google-maps-sdk-ios swift

据 crashlytics 报告,我们的应用程序发生了很多用户崩溃的情况,但我们无法在我们这边重现这些崩溃。这是完整的崩溃报告:

    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
Run Code Online (Sandbox Code Playgroud)

另一个奇怪的事情是,我们没有收到任何额外添加的(发生在哪个屏幕上的)崩溃日志。

附加信息:

最近,我们升级了 iOS 13 和 xcode 11 的应用程序。通过这样做,我们还将谷歌地图 iOS SDK 更新到了 3.8.0。升级后我们收到崩溃报告。在之前使用的版本中,我们从未遇到过这种崩溃,即 2.7.0

在我们的应用程序中,我们有多个 ie 实例,GMSMapView大约 8 个实例嵌入在UIPageViewController. 为了内存管理,我们只保留视图控制器方法GMSMapView中的可见版本并丢弃其他实例。viewDidDisappear这是我们用来设置地图和清除地图的代码。

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
}
Run Code Online (Sandbox Code Playgroud)

来自 crashlytics 的截图:

在此输入图像描述

crashlytics 数据选项卡的屏幕截图:

在此输入图像描述

小智 -1

只需降级到 3.7.0 iOS Maps SDK 即可。

pod 'GoogleMaps', '~> 3.7.0'
Run Code Online (Sandbox Code Playgroud)