AudioServicesPlaySystemSound哑于模拟器xCode 6 GM

时间:2021-05-03 18:19:18

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);

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

该代码已在xCode 5和ios7上成功测试。图书馆根据需要进口。

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

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

Has anyone experienced a similar issue?

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

2 个解决方案

#1


8  

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

这是模拟器的问题。在设备上,它会像预期的那样工作。

#2


3  

I have a similar issue now. My AudioServicesPlaySystemSound was working until the XCode update to 6.0.1. One could assume that there is something broken in the update.

我现在有一个类似的问题。我的AudioServicesPlaySystemSound一直工作到XCode更新到6.0.1。有人可能会认为更新中出现了问题。

#1


8  

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

这是模拟器的问题。在设备上,它会像预期的那样工作。

#2


3  

I have a similar issue now. My AudioServicesPlaySystemSound was working until the XCode update to 6.0.1. One could assume that there is something broken in the update.

我现在有一个类似的问题。我的AudioServicesPlaySystemSound一直工作到XCode更新到6.0.1。有人可能会认为更新中出现了问题。