【问题标题】:Play sound in Sprite Kit在 Sprite Kit 中播放声音
【发布时间】:2014-02-13 14:52:23
【问题描述】:

我在 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 中播放音频的方式,但我一定是做错了什么..

【问题讨论】:

    标签: ios objective-c sprite-kit


    【解决方案1】:

    从您的项目中删除该文件并重新添加。 记得选择

    Copy items into destination group...
    

    并选择您的项目作为目标(不是测试)。

    【讨论】:

    • 哇,真的有效!谢谢!我会尽快接受你的回答。 (有时间限制)
    猜你喜欢
    • 2017-03-31
    • 1970-01-01
    • 2017-01-24
    • 2022-07-08
    • 2021-09-05
    • 1970-01-01
    • 2011-01-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多