我是Swift的新手。在发布新的IOS之前,我的游戏只能在Apple Store中使用。现在它可以成功构建,但是当我单击“开始”按钮时失败。
我的代码找不到任何错误。
请检查以下异常:
异常“ NSInvalidArgumentException”,原因:“ SKAction animateWithTextures:纹理数组不能为空”
***首先抛出调用堆栈:
(
0 CoreFoundation 0x0000000109cca34b异常预处理+ 171
1个libobjc.A.dylib 0x00000001093c521e objc_exception_throw + 48
2 CoreFoundation 0x0000000109d33265 + [NSException提高:格式:] + 197
3 SpriteKit 0x000000010a7e1f81 + [SKAnimate animateWithTextures:timePerFrame:resize:restore:] + 120
4 SpriteKit 0x000000010a7ddd71 + [SKAction(SKActions)animateWithTextures:timePerFrame:] + 29
5 TwistyPlane 0x0000000108dc3aea _TFC11TwistyPlane9GameScenecfT5coderCSo7NSCoder_GSqS0 + 906
6 TwistyPlane 0x0000000108dc3c0d _TToFC11TwistyPlane9GameScenecfT5coderCSo7NSCoder_GSqS0__ + 45
7基础0x0000000108e95f12 _decodeObjectBinary + 2622
8基础0x0000000108e953c6 _decodeObject + 249
9 SpriteKit 0x000000010a84126b + [SKNode nodeWithFileNamed:] + 578
10 TwistyPlane 0x0000000108dc6fdd _TTOFCSo7SKSceneCfT9fileNamedSS_GSqS__ + 77
11 TwistyPlane 0x0000000108dc6d31 _TFC11TwistyPlane18GameViewController11viewDidLoadfT_T_ + 129
12 TwistyPlane 0x0000000108dc7032 _TToFC11TwistyPlane18GameViewController11viewDidLoadfT_T_ + 34
13 UIKit 0x000000010abcf06d-[UIViewController loadViewIfRequired] + 1258
14 UIKit 0x000000010abcf4a0-[UIViewController视图] + 27
15 UIKit 0x000000010b4938d0-[_ UIFullscreenPresentationController _setPresentedViewController:] + 87
16 UIKit 0x000000010aba9d26-[UIPresentationController initWithPresentedViewController:presentingViewController:] + 141
17 UIKit 0x000000010abe230b-[UIViewController _presentViewController:withAnimationController:completion:] + 3956
18 UIKit 0x000000010abe56df-[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 530
19 UIKit 0x000000010abe51c5-[UIViewController presentViewController:animated:completion:] + 179
20 UIKit 0x000000010abea892-[UIViewController _showViewController:withAction:sender:] + 274
21 UIKit 0x000000010b0af1b6 66- [UIStoryboardShowSegueTemplate newDefaultPerformHandlerForSegue:] _ block_invoke + 134
22 UIKit 0x000000010b20840d-[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 447
23 UIKit 0x000000010b20821d-[UIStoryboardSegueTemplate _perform:] + 82
24 UIKit 0x000000010b2084df-[UIStoryboardSegueTemplate执行:] + 156
25 UIKit 0x000000010aa2fb88-[UIApplication sendAction:to:from:forEvent:] + 83
26 UIKit 0x000000010abb52b2-[UIControl sendAction:to:forEvent:] + 67
27 UIKit 0x000000010abb55cb-[UIControl _sendActionsForEvents:withEvent:] + 444
28 UIKit 0x000000010abb44c7-[UIControl touchesEnded:withEvent:] + 668
29 UIKit 0x000000010aa9d0d5-[UIWindow _sendTouchesForEvent:] + 2747
30 UIKit 0x000000010aa9e7c3-[UIWindow sendEvent:] + 4011
31 UIKit 0x000000010aa4ba33-[UIApplication sendEvent:] + 371
32 UIKit 0x000000010b23db6d __dispatchPreprocessedEventFromEventQueue + 3248
33 UIKit 0x000000010b236817 __handleEventQueue + 4879
34 CoreFoundation 0x0000000109c6f311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
35 CoreFoundation 0x0000000109c5459c __CFRunLoopDoSources0 + 556
36 CoreFoundation 0x0000000109c53a86 __CFRunLoopRun + 918
37 CoreFoundation 0x0000000109c53494 CFRunLoopRunSpecific + 420
38 GraphicsServices 0x000000010ff39a6f GSEventRunModal + 161
39 UIKit 0x000000010aa2df34 UIApplicationMain + 159
40 TwistyPlane 0x0000000108dc956f主+ 111
41 libdyld.dylib 0x000000010dceb68d开始+ 1
)
libc ++ abi.dylib:以NSException类型的未捕获异常终止
(lldb)
最佳答案
它说您在第一行“ SKAction animateWithTextures:纹理数组不能为空”中的错误检查您的代码,并确保此投诉得到满足。似乎您正在调用或使用空数组来调用数据。程序崩溃,因为没有任何返回。这就是我所看到的。
关于swift - 升级到Xcode 8后我的游戏停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39842979/