UILocalNotification作为每天的固定时间被激活

时间:2011-07-25 07:28:26

标签: iphone datetime uilocalnotification

我想将firedate的{​​{1}}设置为每天上午11:00和晚上11:00(每12小时一次)。我怎样才能做到这一点?请建议。

1 个答案:

答案 0 :(得分:-1)

创建两个单独的UILocalNotifications并指定重复间隔。

enum {
   NSEraCalendarUnit = kCFCalendarUnitEra,
   NSYearCalendarUnit = kCFCalendarUnitYear,
   NSMonthCalendarUnit = kCFCalendarUnitMonth,
   NSDayCalendarUnit = kCFCalendarUnitDay,
   NSHourCalendarUnit = kCFCalendarUnitHour,
   NSMinuteCalendarUnit = kCFCalendarUnitMinute,
   NSSecondCalendarUnit = kCFCalendarUnitSecond,
   NSWeekCalendarUnit = kCFCalendarUnitWeek,
   NSWeekdayCalendarUnit = kCFCalendarUnitWeekday,
   NSWeekdayOrdinalCalendarUnit = kCFCalendarUnitWeekdayOrdinal,
   NSQuarterCalendarUnit = kCFCalendarUnitQuarter,
   NSCalendarCalendarUnit = (1 << 20),
   NSTimeZoneCalendarUnit = (1 << 21),
};
typedef NSUInteger NSCalendarUnit;