播放系统声音需要导入
#import <AudioToolbox/AudioToolbox.h>
//———————————————————播放提示声音——————————————————————— NSString *filePath = [[NSBundle mainBundle] pathForResource:@"msgcome" ofType:@"wav"]; NSURL *url = [NSURL fileURLWithPath:filePath]; //1.将声音文件注册成系统声音 SystemSoundID soundID; AudioServicesCreateSystemSoundID((__bridge CFURLRef)(url), &soundID); //2.播放系统声音 AudioServicesPlaySystemSound(soundID);