我在模拟器上运行以下代码,但没有任何声音:
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,它返回了文件系统上的正确位置。
有没有人遇到过类似的问题?
这是模拟器的问题。在设备上可以正常工作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句