Catch/guard [SCNSpriteKitEventHandler touchesCancelled:withEvent:] 更早崩溃?

Catch/guard crash earlier for [SCNSpriteKitEventHandler touchesCancelled:withEvent:]?

谁能帮我确定我的应用程序崩溃的原因,或者我如何才能更好地及早发现崩溃以了解导致崩溃的代码行?

这是来自 Crashlytics 的崩溃日志:

#0
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000010

Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x188ecef70 objc_msgSend + 16
1  SceneKit                       0x19a486324 -[SCNSpriteKitEventHandler touchesCancelled:withEvent:] + 528
2  SceneKit                       0x19a5666c8 -[SCNView touchesCancelled:withEvent:] + 60
3  UIKit                          0x1904cde04 __98-[UIApplication _cancelViewProcessingOfTouches:withEvent:sendingTouchesCancelledToViewsOfTouches:]_block_invoke + 552
4  UIKit                          0x1903c4b44 -[UIApplication _cancelTouches:withEvent:includingGestures:notificationBlock:] + 908
5  UIKit                          0x1904cdb84 -[UIApplication _cancelViewProcessingOfTouches:withEvent:sendingTouchesCancelledToViewsOfTouches:] + 172
6  UIKit                          0x1908f76ec _UIGestureEnvironmentCancelTouches + 628
7  UIKit                          0x1908f7464 -[UIGestureEnvironment _cancelTouches:event:] + 52
8  UIKit                          0x19036c438 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 1604
9  UIKit                          0x1908f6680 _UIGestureEnvironmentUpdate + 1100
10 CoreFoundation                 0x18a4320c0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
11 CoreFoundation                 0x18a42fcf0 __CFRunLoopDoObservers + 372
12 CoreFoundation                 0x18a430180 __CFRunLoopRun + 1024
13 CoreFoundation                 0x18a35e2b8 CFRunLoopRunSpecific + 444
14 GraphicsServices               0x18be12198 GSEventRunModal + 180
15 UIKit                          0x1903a57fc -[UIApplication _run] + 684
16 UIKit                          0x1903a0534 UIApplicationMain + 208
17 activeMaze                     0x1000f4b08 main (ArchiveKeys.swift:9)
18 libdispatch.dylib              0x1893415b8 (Missing)

此崩溃仅发生在分布式应用程序中,我在调试时无法复制,因此 "Enable Zombie Objects" 似乎没有帮助。

谢谢

格雷格

崩溃是因为我从 SCNView 中删除 SKScene (.overlaySKScene) 的方式:

我将其设置为 nil,这在 99% 的时间都有效,并且始终在 sim 上有效,但它不正确:

    maze3DScene.overlaySKScene = nil

我应该像删除 SCNNode 一样从父 SCNView 中删除 SKScene:

    maze3DScene.overlaySKScene?.removeFromParent()

希望这对可能犯同样错误的其他人有所帮助。