#import <AudioToolbox/AudioToolbox.h>
//用系统音量播放
SystemSoundID soundID;
// 加载文件
NSURL *fileURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:soundName ofType:@"wav"]];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)(fileURL), &soundID);
// 播放短频音效
AudioServicesPlayAlertSound(soundID);
// 增加震动效果,如果手机处于静音状态,提醒音将自动触发震动
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
#import <AVFoundation/AVFoundation.h>
//用媒体音量播放
NSURL *fileURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:soundName ofType:@"wav"]];
self.audioplay = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:nil];
[self.audioplay play];