在iPhone中播放一些系统铃声,模拟器中运行的好好的,但是在真机中不播放了。
- (IBAction)SystemSound:(id)sender {
NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:@"waterfall" ofType:@"caf"];
NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)soundFileURL, &systemSound);
AudioServicesPlaySystemSound(systemSound);
}