【问题标题】:AudioServicesPlaySystemSound muted on simulator xCode 6 GMAudioServicesPlaySystemSound 在模拟器 xCode 6 GM 上静音
【发布时间】:2014-09-16 01:25:11
【问题描述】:

我在模拟器上运行以下代码,但没有听到任何声音:

NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"pageflip" ofType:@"mp3"];
NSURL *soundUrl = [NSURL fileURLWithPath:soundPath];

AudioServicesCreateSystemSoundID((__bridge CFURLRef) soundUrl, &_soundEffect);
AudioServicesPlaySystemSound(_soundEffect);

代码已在 xCode 5 和 iOS 7 上成功测试。根据需要导入库。

我已经记录了 soundPath,它返回了文件系统上的正确位置。

有没有人遇到过类似的问题?

【问题讨论】:

    标签: ios xcode avaudioplayer


    【解决方案1】:

    这是模拟器的问题。在设备上它会按预期工作。

    【讨论】:

      【解决方案2】:

      我现在也有类似的问题。我的 AudioServicesPlaySystemSound 一直在工作,直到 XCode 更新到 6.0.1。可以假设更新中出现了问题。

      【讨论】:

      • 其实我最近才知道这是模拟器的问题。一旦我在设备上进行了测试,它就可以像以前一样工作。无需更改。
      猜你喜欢
      • 2014-11-08
      • 2013-09-19
      • 2014-11-03
      • 2014-11-05
      • 2014-11-05
      • 2018-02-22
      • 1970-01-01
      • 1970-01-01
      • 2015-12-07
      相关资源
      最近更新 更多