Bha*_*rat 6 iphone objective-c ios uilocalnotification
在我的应用程序中,我要设置重复UILocalNotification.我可以通过执行每日,每周等设置repeatInterval
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.repeatInterval = NSDayCalendarUnit; // or any other calendarUnit
Run Code Online (Sandbox Code Playgroud)
好的..没关系,但我要每14天设置一次repeatInterval.我从这个链接中了解到,我们只能使用其中一个NSCalendarUnit重复间隔.因此,您可以重复间隔为一分钟或一小时或一天但不是五分钟或三小时或14天.关于iOS 5或更高版本中此限制的任何想法(该文章是为iOS 4.0编写的)?
小智 7
您只能将重复间隔设置为日历单位.为了获得正确的时间间隔,您可能需要设置多个通知.
例如,如果您希望每20分钟发出一次通知,则必须在20分钟内创建3个通知,并且重复间隔为NSHourCalendarUnit.
在你的情况下,问题是,从周单位开始的下一个事情是一个月,但一个月不是4个星期.
要实际设置每14天一次的通知,您必须创建26个通知,重复间隔为NSYearCalendarUnit.
| 归档时间: |
|
| 查看次数: |
7773 次 |
| 最近记录: |