当我点击重启我创建的游戏时,我发现了这个错误。它在与GameScene不同的单独SKScene中调用,并用touchesBegan()编写。我的代码中是否缺少某些内容?
这是:
import SpriteKit
class GameOver: SKScene {
override init(size: CGSize) {
super.init(size: size)
...
}
override func touchesBegan() {
let reveal = SKTransition.fadeWithDuration(0.5)
let gameScene = GameScene(size: self.size)
self.view!.presentScene(gameScene, transition: reveal)
}
}
_TFC13Penguin_Peril8GameOver12touchesBeganfS0_FTGVSs3SetCSo7UITouch_9withEventGSqCSo7UIEvent__T_ + 397
10 Penguin Peril 0x0000000108a30cf2 _TToFC13Penguin_Peril8GameOver12touchesBeganfS0_FTGVSs3SetCSo7UITouch_9withEventGSqCSo7UIEvent__T_ + 98
11 SpriteKit 0x000000010a835c4a -[SKView touchesBegan:withEvent:] + 941
12 UIKit 0x000000010aa52894 -[UIWindow _sendTouchesForEvent:] + 308
13 UIKit 0x000000010aa53691 -[UIWindow sendEvent:] + 865
14 UIKit 0x000000010aa05752 -[UIApplication sendEvent:] + 263
15 UIKit 0x000000010a9e0fcc _UIApplicationHandleEventQueue + 6693
16 CoreFoundation 0x000000010a0380a1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
17 CoreFoundation 0x000000010a02dfcc __CFRunLoopDoSources0 + 556
18 CoreFoundation 0x000000010a02d483 __CFRunLoopRun + 867
19 CoreFoundation 0x000000010a02ce98 CFRunLoopRunSpecific + 488
20 GraphicsServices 0x000000010e98dad2 GSEventRunModal + 161
21 UIKit 0x000000010a9e6676 UIApplicationMain + 171
22 Penguin Peril 0x0000000108a49afd main + 109
23 libdyld.dylib 0x000000010cac092d start + 1
) libc ++ abi.dylib:以NSException类型的未捕获异常终止 (lldb)