所以我发布了一个 swift/spritekit 游戏。
很遗憾,我收到有关运行 iOS 8.1 的 iPhone 5C 崩溃的报告。
所以我下载了 iOS 8.1 模拟器并进行了测试,果然它在启动画面后崩溃了:(
它抛出这个错误:
NSInvalidArgumentException', reason: 'Resource count cannot be found in the main bundle'
*** First throw call stack:
//stuff
)
libc++abi.dylib: terminating with uncaught exception of type NSException
我试过谷歌搜索,但没有返回任何特别的信息。 有什么想法可能是造成这种情况的原因吗?
最佳答案
在抛出的错误中看到的资源 count
是一个资源文件:
NSInvalidArgumentException',原因:'Resource
count cannot be found in the main bundle'
在 iOS 8
中,使用 playSoundFileNamed
加载到 SKActions
的音频资源,要求文件名中包含文件格式:
让 count = SKAction.playSoundFileNamed("count.wav", waitForCompletion: false)
添加.wav
后,一切正常。
感谢 JP_Mob 在问题的评论部分指出这一点。
关于ios - NSInvalidArgumentException',原因 : 'Resource count cannot be found in the main bundle' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37644492/