【发布时间】:2010-08-12 16:33:36
【问题描述】:
我似乎无法在设备或模拟器中播放 AudioServices 声音。这是我的代码:
NSString *sndPath = [[NSBundle mainBundle] pathForResource:@"click" ofType:@"aiff"];
SystemSoundID soundID;
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:sndPath], &soundID);
AudioServicesPlaySystemSound(soundID);
AudioServicesDisposeSystemSoundID(soundID);
我检查了我的系统偏好设置,是的,我确实勾选了“播放用户界面音效”...我可能做错了什么?
谢谢!
编辑:我正在尝试在用户在设备上移动触摸时创建音频点击,因此我需要它来快速播放相同的声音。我应该改用 AVAudioPlayer 吗?
【问题讨论】:
标签: iphone ipad audio ios-simulator