在Sprite工具包中替换场景时崩溃

时间:2014-01-25 12:56:49

标签: ios ios7 sprite-kit

这是我复制场景的代码:

SKScene * menu = [GameScene sceneWithSize:self.size];
SKTransition *transitionGameScene = [SKTransition fadeWithColor:[UIColor whiteColor] duration:2.0];
transitionGameScene.pausesIncomingScene = NO;
[self.view presentScene:menu transition:transitionGameScene];
return;

但是没有正常工作,当我按下按钮重新启动关卡时会调用此代码,有时候关卡重启没有任何问题,有时会崩溃,但是调试器没有给我任何错误,这是屏幕xcode:

enter image description here

这是NSLog(@“%@”,[NSThread callStackSymbols]);

0   Game                                0x000bdbe3 -[GameScene repleceScene] + 58
1   Game                                0x000bd875 __39-[GameScene sidebar:didTapItemAtIndex:]_block_invoke300 + 44
2   Game                                0x000d19f5 __47-[RNFrostedSidebar dismissAnimated:completion:]_block_invoke + 324
3   UIKit                               0x32510e6d <redacted> + 284
4   UIKit                               0x32510ab7 <redacted> + 178
5   UIKit                               0x325109cf <redacted> + 66
6   QuartzCore                          0x32166413 <redacted> + 234
7   libdispatch.dylib                   0x3a5960af <redacted> + 22
8   libdispatch.dylib                   0x3a5989a9 _dispatch_main_queue_callback_4CF + 268
9   CoreFoundation                      0x2fd1f5b1 <redacted> + 8
10  CoreFoundation                      0x2fd1de7d <redacted> + 1308
11  CoreFoundation                      0x2fc88471 CFRunLoopRunSpecific + 524
12  CoreFoundation                      0x2fc88253 CFRunLoopRunInMode + 106
13  GraphicsServices                    0x349c22eb GSEventRunModal + 138
14  UIKit                               0x3253d845 UIApplicationMain + 1136
15  Game                                0x000ad205 main + 116
16  libdyld.dylib                       0x3a5aaab7 <redacted> + 2

有人可以帮我理解问题出在哪里吗?

1 个答案:

答案 0 :(得分:0)

我的代码有效,看起来与您的代码完全相同,只有两个例外。

  1. 尝试删除transitionGameScene.pausesIncomingScene = NO;
    1. 删除退货(无法查看其余代码,但如果您要更换现场,我认为您不需要此退货)
    2. 尝试这两种方法并回复我。