【问题标题】:AVAudioPlayer in Sprite Kit 'Failed to load resource' reason resource 'could not load sound.caf'Sprite Kit 中的 AVAudioPlayer“加载资源失败”原因资源“无法加载 sound.caf”
【发布时间】:2013-12-28 03:07:52
【问题描述】:

当用户按下正确答案时,我正在尝试播放声音效果。代码如下:

if ([node.name isEqualToString:correctAnswer]) {
    [self runAction:[SKAction playSoundFileNamed:@"correct.caf" waitForCompletion:NO]];
}

当我运行应用程序并按下按钮时,应用程序会引发异常:

*** Terminating app due to uncaught exception 'Failed to Load Resource', reason: 'Resource correct.caf can not be loaded'

目前关于 Sprite Kit 的文档不多,所以我不知道这是否是在 Sprite Kit 中播放音效的正确方法。我正在关注 Ray Wenderlich 教程:http://www.raywenderlich.com/42699/spritekit-tutorial-for-beginners 有什么建议吗?

【问题讨论】:

    标签: audio avaudioplayer sprite-kit soundeffect


    【解决方案1】:

    您要的是一个名为“correct.caf”的东西,而您的应用程序包中没有这样的东西。创建一个名为“correct.caf”的 CAF 声音文件并将其添加到您的项目中。或者将一些其他声音文件添加到您的项目中并引用它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-24
      • 2018-01-15
      • 2013-02-26
      • 2019-05-28
      • 2016-06-24
      相关资源
      最近更新 更多