如果提供重复通知,UILocalNotification 计数 iOS
UILocalNotification count in iOS if Repetitive Notification provided
我正在我的应用程序中开发警报应用程序,用户也可以添加具有重复模式的警报,所以我使用
例如:
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *componentsForFireDate = [calendar components:(NSCalendarUnitYear | NSCalendarUnitWeekOfYear | NSCalendarUnitHour | NSCalendarUnitMinute| NSCalendarUnitSecond | NSCalendarUnitWeekday) fromDate: [dictionaryForAlarm objectForKey:AlarmDate]];
// every day
localNotification.repeatInterval = NSCalendarUnitDay;
localNotification.fireDate=[calendar dateFromComponents:componentsForFireDate];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
正如我所见,iOS 允许为每个应用程序仅安排 64 个本地通知。
So i want to know that weather in my repeat alarm if i am scheduling
one notification with repeat interval then how many notification will
iOS consider for this? (Weather Single or Depends on repeat)
只有一个,如果您使用repeatInterval
系统只考虑一个通知。您可以通过询问 UIApplication
实例 scheduledLocalNotifications
.
来轻松检查
我正在我的应用程序中开发警报应用程序,用户也可以添加具有重复模式的警报,所以我使用 例如:
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *componentsForFireDate = [calendar components:(NSCalendarUnitYear | NSCalendarUnitWeekOfYear | NSCalendarUnitHour | NSCalendarUnitMinute| NSCalendarUnitSecond | NSCalendarUnitWeekday) fromDate: [dictionaryForAlarm objectForKey:AlarmDate]];
// every day
localNotification.repeatInterval = NSCalendarUnitDay;
localNotification.fireDate=[calendar dateFromComponents:componentsForFireDate];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
正如我所见,iOS 允许为每个应用程序仅安排 64 个本地通知。
So i want to know that weather in my repeat alarm if i am scheduling one notification with repeat interval then how many notification will iOS consider for this? (Weather Single or Depends on repeat)
只有一个,如果您使用repeatInterval
系统只考虑一个通知。您可以通过询问 UIApplication
实例 scheduledLocalNotifications
.