我試圖在我的iPhone應用程序中播放短暫的鬧鐘聲音 我使用了我發現的這段代碼,但它不會播放任何聲音。IOS播放短音
NSString *toneFilename = [[NSBundle mainBundle] pathForResource:@"alarm" ofType:@"wav"];
NSURL *toneURLRef = [NSURL fileURLWithPath:toneFilename];
SystemSoundID Sound;
AudioServicesCreateSystemSoundID(
(__bridge CFURLRef) toneURLRef,
&camerSound
);
AudioServicesPlaySystemSound(Sound);
當我試圖使振動它的工作原理,但:
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
THX
嘗試在設備上,忘記模擬器 – 2012-12-09 14:58:00