AudioServicesPlaySystemSound 在模拟器 xCode 6 GM 上静音

2024-02-24

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

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,它返回文件系统上的正确位置。

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


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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

AudioServicesPlaySystemSound 在模拟器 xCode 6 GM 上静音 的相关文章

随机推荐