[SCNSpriteKitEventHandler touchesCancelled:withEvent:]之前的Catch / guard崩溃?

时间:2017-03-28 09:48:04

标签: ios swift sprite-kit scenekit skscene

有人可以帮我确定我的应用程序崩溃的原因,或者我如何更好地抓住崩溃,以了解造成它的代码行?

这是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)

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

由于

格雷格

1 个答案:

答案 0 :(得分:2)

崩溃来自我从SCNView中删除SKScene(.overlaySKScene)的方式:

我将它设置为nil,99%的时间可以正常工作并且始终在SIM卡上工作,但这不正确:

    maze3DScene.overlaySKScene = nil

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

    maze3DScene.overlaySKScene?.removeFromParent()

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