基本上,當我的應用程序上的按鈕被觸摸時,播放音頻。很簡單,但它卻無法在我的實際設備上工作,但在模擬器中運行良好。當按鈕被觸摸時,執行該功能:音頻將在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