我正在iOS目标c中的报警基础项目上工作。 我在应用程序的后台执行了UILocalnotification
报警。 但我面临的问题是声音只能播放30秒。超过30秒的报警应用程序的UILocalnotification
我该如何增加声音的时间间隔或是否有其他方法来实现它,而不是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.
请指教。 谢谢
您需要将该文件分成多个30s声音文件,并发出多个通知 – Tj3n
@ Tj3n感谢您的回复。但我的mp3文件更多是30秒。 –