我需要创建一个闹钟应用程序,它可以在手机处于静音模式时播放声音。
根据这一点,可以使用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?