本身要準備一個聲音文件,這裏是wav的 url
NSString *path = [[NSBundle mainBundle] pathForResource:@"msgcome" ofType:@"wav"]; NSURL *url = [NSURL fileURLWithPath:path]; SystemSoundID soundId; AudioServicesCreateSystemSoundID((CFURLRef)url, &soundId); AudioServicesPlaySystemSound(soundId);