Swift - 启动屏幕后游戏崩溃并且无法转换到 GameScene NSException 错误
Posted
技术标签:
【中文标题】Swift - 启动屏幕后游戏崩溃并且无法转换到 GameScene NSException 错误【英文标题】:Swift - Game crashes after launchScreen and cannot transition to GameScene NSException Error 【发布时间】:2019-12-08 18:22:22 【问题描述】:我试图重做我的 LaunchScreen.storyboard,所以我删除了它并通过文件(在工具栏中)> 新建 > 新文件 > 启动屏幕创建了一个新的 LaunchScreen,然后我开始遇到这个问题。我已经检查了我的 IBOutlet 连接。我删除了新的 LaunchScreen.storyboard,希望能解决它,但它仍然无法转换到我的 GameScene。我在游戏中使用 SpriteKit 和 UICollectionView。
Debug Navigator Screenshot
AppDelegate SIGABRT Screenshot
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) e Thread.callStackSymbols.forEachprint($0)
0 ??? 0x00000001062343cc 0x0 + 4397941708
1 Billionaire City 0x00000001006e23b8 main + 0
2 libsystem_c.dylib 0x00000001c28f7ea8 abort + 140
3 libc++abi.dylib 0x00000001c1fc4788 __cxa_bad_cast + 0
4 libc++abi.dylib 0x00000001c1fc4934 <redacted> + 0
5 libobjc.A.dylib 0x00000001c1fdbe00 <redacted> + 124
6 libc++abi.dylib 0x00000001c1fd0838 <redacted> + 16
7 libc++abi.dylib 0x00000001c1fd01a8 __cxa_get_exception_ptr + 0
8 libc++abi.dylib 0x00000001c1fd0168 <redacted> + 0
9 libobjc.A.dylib 0x00000001c1fdbb3c <redacted> + 0
10 CoreFoundation 0x00000001c2d1d278 <redacted> + 0
11 CoreFoundation 0x00000001c2e05d60 <redacted> + 1408
12 CoreFoundation 0x00000001c2e079fc _CF_forwarding_prep_0 + 92
13 CoreText 0x00000001c6a178d0 <redacted> + 92
14 UIFoundation 0x00000001cd3edf78 <redacted> + 120
15 CoreText 0x00000001c6a1707c <redacted> + 84
16 CoreText 0x00000001c6a169d0 <redacted> + 92
17 CoreText 0x00000001c6a16834 <redacted> + 104
18 CoreText 0x00000001c69c660c <redacted> + 216
19 CoreText 0x00000001c69c651c <redacted> + 160
20 CoreText 0x00000001c69c1da4 CTTypesetterCreateWithAttributedString + 60
21 SpriteKit 0x00000001d98f1c04 _ZN12SKCLabelNode11rebuildTextEv + 1064
22 libdispatch.dylib 0x00000001019f8c74 _dispatch_client_callout + 16
23 libdispatch.dylib 0x0000000101a07480 _dispatch_lane_barrier_sync_invoke_and_complete + 124
24 SpriteKit 0x00000001d98f1230 _ZN12SKCLabelNode21addRenderableChildrenEP13SKCRenderInfoPNSt3__16vectorIP7SKCNodeNS2_9allocatorIS5_EEEE + 92
25 SpriteKit 0x00000001d99aed90 _ZN11SKCRenderer18doBuildRenderGroupEP7SKCNode14SKCRenderState13simd_float4x4 + 372
26 SpriteKit 0x00000001d99aefb8 _ZN11SKCRenderer18doBuildRenderGroupEP7SKCNode14SKCRenderState13simd_float4x4 + 924
27 SpriteKit 0x00000001d99aefb8 _ZN11SKCRenderer18doBuildRenderGroupEP7SKCNode14SKCRenderState13simd_float4x4 + 924
28 SpriteKit 0x00000001d99ae2fc _ZN11SKCRenderer16buildRenderGroupERKNSt3__110shared_ptrI18SKCRenderSortGroupEE + 940
29 SpriteKit 0x00000001d99ab608 _ZN11SKCRenderer15buildRenderPassERKNSt3__110shared_ptrI13SKCRenderPassEE + 96
30 SpriteKit 0x00000001d99aaea0 _ZN11SKCRenderer6renderEP7SKCNodeDv4_fRKNSt3__110shared_ptrI15jet_framebufferEEDv4_j13simd_float4x4bP12NSDictionaryP8SKCStatsSE_d + 1628
31 SpriteKit 0x00000001d9928c80 <redacted> + 664
32 SpriteKit 0x00000001d9928958 <redacted> + 252
33 SpriteKit 0x00000001d992cbec <redacted> + 184
34 UIKitCore 0x00000001ef7cbe54 <redacted> + 1292
35 QuartzCore 0x00000001c728e1f0 <redacted> + 184
36 QuartzCore 0x00000001c7293198 <redacted> + 332
37 QuartzCore 0x00000001c71f60a8 <redacted> + 348
38 QuartzCore 0x00000001c7224108 <redacted> + 640
39 UIKitCore 0x00000001ef35c534 <redacted> + 124
40 CoreFoundation 0x00000001c2d9210c <redacted> + 20
41 CoreFoundation 0x00000001c2d91a10 <redacted> + 272
42 CoreFoundation 0x00000001c2d8ca74 <redacted> + 1024
43 CoreFoundation 0x00000001c2d8c354 CFRunLoopRunSpecific + 436
44 GraphicsServices 0x00000001c4f8c79c GSEventRunModal + 104
45 UIKitCore 0x00000001ef343b68 UIApplicationMain + 212
46 Billionaire City 0x00000001006e2404 main + 76
47 libdyld.dylib 0x00000001c28528e0 <redacted> + 4
(lldb)
【问题讨论】:
【参考方案1】:应用程序最好使用LaunchScreen
运行。
为了解决您的问题,请尝试添加一个新的LaunchScreen
,然后前往Project Settings - General
并从Launch Screen File
下拉菜单中选择您的新LaunchScreen
。
您也可以在没有LaunchScreen
的情况下运行它。从Xcode
和Finder
的项目中删除LaunchScreen
,然后前往Project Settings - General
并从Launch Screen File
下拉菜单中选择scene-name (Main)
。
【讨论】:
以上是关于Swift - 启动屏幕后游戏崩溃并且无法转换到 GameScene NSException 错误的主要内容,如果未能解决你的问题,请参考以下文章
Spritekit 应用程序在设备上运行时崩溃,在 swift 3 转换后在模拟器上工作
Android Studio:启动屏幕后应用程序崩溃[重复]