我在 myScene.h 中有以下代码:
#import <AVFoundation/AVFoundation.h>
touchBegin 方法中的这段代码:
[self runAction:[SKAction playSoundFileNamed:@"fire.m4a" waitForCompletion:NO]];
音频文件位于主文件夹中。当我运行应用程序并触摸应用程序关闭时,出现以下错误:
Terminating app due to uncaught exception 'Missing Resource', reason: 'Resource fire.m4a cannont be found in the main bundle'
我认为这是在 Sprite Kit 中播放音频的方式,但我一定是做错了什么..
最佳答案
从您的项目中删除文件并重新添加。 记得选择
Copy items into destination group...
并选择您的项目作为目标(不是测试)。
关于ios - 在 Sprite Kit 中播放声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21757550/