Ios 报警应用程序的UILocalnotification持续30秒以上
我在iOS objective c的Alarm base项目中工作。 我已经为应用程序处于后台时的报警实现了Ios 报警应用程序的UILocalnotification持续30秒以上,ios,objective-c,uilocalnotification,repeatingalarm,Ios,Objective C,Uilocalnotification,Repeatingalarm,我在iOS objective c的Alarm base项目中工作。 我已经为应用程序处于后台时的报警实现了UILocalnotification。 但我面临的问题是声音只能播放30秒 如何增加声音的时间间隔,或者是否有其他方法来实现它,而不是UILocalnotification - (IBAction)Alert:(id)sender{ NSDateFormatter *format = [[NSDateFormatter alloc] init]; [
UILocalnotification
。
但我面临的问题是声音只能播放30秒
如何增加声音的时间间隔,或者是否有其他方法来实现它,而不是UILocalnotification
- (IBAction)Alert:(id)sender{
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"yyyy-MM-dd"];
//NSDate *date = [NSDate date];
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate =[NSDate dateWithTimeIntervalSinceNow:15];
localNotif.timeZone = [NSTimeZone localTimeZone];
localNotif.alertBody = @"Emergency";
localNotif.alertAction = @"View";
localNotif.soundName = @"police.mp3";
localNotif.applicationIconBadgeNumber = 1;
localNotif.repeatInterval = NSYearCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
}
Note : mp3 file i am using for UILocalnotification is of more that 60min duration.
请给我一些建议。
谢谢如果设备处于活动模式,通知声音仅播放5秒钟。如果设备处于睡眠模式,通知将播放30秒的声音。我想,这是标准行为 根据苹果的指导方针,你需要使用持续时间为30秒的mp3文件。请查看下面的链接
注意:仅供参考,iOS10不推荐使用UILocalNotification。您需要开始使用UnuseNotificationCenter。您需要将该文件拆分为多个30秒声音文件,并制作多个notification@Tj3n谢谢你的回复。但是我的mp3文件超过30秒。除了通知之外,还有其他方法实现报警功能吗?因为通知只能播放5或30秒。然而,预期的结果是它应该播放60秒以上?这是不可能的,除非您设置了两个本地通知。iOS的报警应用程序拥有播放声音超过30秒的特权。请检查可能对您有帮助的链接。