【问题标题】:sounds are not being played in my iOS app?我的 iOS 应用程序中没有播放声音?
【发布时间】:2011-11-02 22:39:12
【问题描述】:

我有一个应该播放 3 种不同声音的应用,我在 ViewDidLoad 中这样定义它们:

AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"2357_02" ofType:@"m4a"]], &addedSound);
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"2357_01" ofType:@"m4a"]], &updatedSound);
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"notifier_12" ofType:@"m4a"]], &notFoundSound);

我提示他们这样玩:

AudioServicesPlaySystemSound(addedSound);

他们在模拟器上玩但不在 ipad 上玩?在 Copy Bundle Resources 下的 Build Phases 中,我看到它们已列出,因此我认为它们应该将其作为我的应用程序的一部分 - 我在这里缺少什么?

【问题讨论】:

  • 不愿说出显而易见的事实,但您确定设备未设置为静音?这是一件愚蠢的事情,但我忘记检查一次并敲了几分钟的头......
  • 欺骗?你的声音是不是太长了:stackoverflow.com/questions/2014578/…

标签: iphone objective-c ios ipad


【解决方案1】:

我实际上在这个问题上使用了 Tammenn 建议的解决方案,它对我很有用: Sound on simulator but not device

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-20
    • 1970-01-01
    • 1970-01-01
    • 2015-11-01
    • 2013-01-18
    • 1970-01-01
    相关资源
    最近更新 更多