需要导入的框架: 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);
}