基本上,当我的应用程序上的按钮被触摸时,播放音频。很简单,但它却无法在我的实际设备上工作,但在模拟器中运行良好。当按钮被触摸时,执行该功能:音频将在iPhone模拟器中播放,但不会在设备上播放
- (IBAction)playButtonSound
{
SystemSoundID buttonSound;
NSURL *tapSound = [[NSBundle mainBundle] URLForResource: @"Button_Sound" withExtension: @"caf"];
CFURLRef buttonSoundURLRef = (CFURLRef) [tapSound retain];
AudioServicesCreateSystemSoundID (buttonSoundURLRef, &buttonSound);
AudioServicesPlaySystemSound(buttonSound);
[tapSound release];
}
我还是一个新手iPhone,所以我不能完全肯定这种情况的原因是什么。
我不这么认为。 是的,我检查了文件名,他们是正确的。 – Robbeh 2011-04-06 03:03:51