有人可以帮助我确定我的应用程序崩溃的原因,或者我如何更好地尽早发现崩溃,以了解哪一行代码导致了崩溃?
这是来自 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)
此崩溃仅发生在分布式应用程序中,并且在调试时无法复制,因此“启用僵尸对象”似乎没有帮助。
谢谢
格雷格
最佳答案
崩溃是由于我从 SCNView 中删除 SKScene (.overlaySKScene) 的方式造成的:
我将其设置为 nil,这在 99% 的情况下都有效,并且始终在 sim 上有效,但它不正确:
maze3DScene.overlaySKScene = nil
我应该像删除 SCNNode 一样从父 SCNView 中删除 SKScene:
maze3DScene.overlaySKScene?.removeFromParent()
希望这可以帮助其他可能犯同样错误的人。
关于ios - 更早捕获/防护 [SCNSpriteKitEventHandler TouchsCancelled :withEvent:]? 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43066194/