需要導入的架構: AudioToolbox.framework
-(void)startWinPlayer
{
//定義URl,要播放的音樂檔案是win.wav
NSURL *audioPath = [[NSURLalloc] initFileURLWithPath:[[NSBundlemainBundle] pathForResource:@"win"ofType:@"wav"]];
//定義SystemSoundID
SystemSoundID soundId;
//C語言的方法調用
//注冊服務
AudioServicesCreateSystemSoundID((__bridgeCFURLRef)audioPath, &soundId);
//增添回調方法
AudioServicesAddSystemSoundCompletion(soundId,NULL, NULL, PlayFinishCallBack,NULL);
//開始播放
AudioServicesPlayAlertSound(soundId);
}