AudioServicesPlaySystemSound在模拟器xCode 6 GM上静音 [英] AudioServicesPlaySystemSound muted on simulator xCode 6 GM

查看:101
本文介绍了AudioServicesPlaySystemSound在模拟器xCode 6 GM上静音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在模拟器上运行以下代码并且没有任何声音:

I run the following code on simulator and I don't get any sound:

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

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

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

The code has been successfully tested on xCode 5 and iOS 7. Libraries imported as required.

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

I've logged the soundPath and it returns the correct location on the filesystem.

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

Has anyone experienced a similar issue?

推荐答案

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

This is an issue with the simulator. On a device it'll work as expected.

这篇关于AudioServicesPlaySystemSound在模拟器xCode 6 GM上静音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆