在iPhone处于静音模式时播放闹钟铃声

时间:2016-01-18 10:26:27

标签: ios objective-c iphone

我需要创建一个闹钟应用程序,它可以在手机处于静音模式时播放声音。

根据这一点,可以使用AVAudioSession但我的问题是如何将其与UILocalNotification连接:

UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.fireDate = fireDate;
notification.alertBody = @"Time to wakeup";
notification.soundName =UILocalNotificationDefaultSoundName;
//    notification.soundName = UILocalNotificationDefaultSoundName;

[[UIApplication sharedApplication] scheduleLocalNotification:notification];
[self presentMessage:@"Alarm shedule complete"];

还有其他办法吗?

我已经尝试了以下链接,但它没有像他们提到的那样工作:How do I start playing audio when in silent mode & locked in iOS 6?

0 个答案:

没有答案
相关问题