【发布时间】:2011-09-16 07:14:19
【问题描述】:
我正在尝试弄清楚如何在特定日期触发本地通知。
我必须使用日历单位,但我找到的关于它们的解释很糟糕。各位能不能给我解释一下,好像我是五岁,它们代表什么区间?
我已经填写了我认为我知道的,如果我错了请纠正我并填写其他的。
NSEraCalendarUnit = ????? era?
NSYearCalendarUnit = event will repeat once in a year at the same month, day and hour
NSMonthCalendarUnit = event will repeat once a month at the same day and hour
NSDayCalendarUnit = event will repeat every day at the same hour
NSHourCalendarUnit = event will repeat every hour at the same minute
NSMinuteCalendarUnit = event will repeat every minute at the same second
NSSecondCalendarUnit = event will repeat every second
NSWeekCalendarUnit = event will repeat the same day of week every week
NSWeekdayCalendarUnit = ?????? can I make it repeat just specific days? I mean, monday to friday but not saturday and sunday?
NSWeekdayOrdinalCalendarUnit = ????? how do I use that?
NSQuarterCalendarUnit = when exactly will it repeat? every 3 months?
NSCalendarCalendarUnit = ?????????
NSTimeZoneCalendarUnit = ????????
这是我需要做的一个例子:
UILocalNotification* alarm = [[[UILocalNotification alloc] init] autorelease];
if (alarm)
{
alarm.fireDate = aDate;
alarm.timeZone = [NSTimeZone systemTimeZone];
alarm.repeatInterval = WHAT DO I PUT HERE? TO MAKE IT REPEAT JUST SATURDAYS AND SUNDAYS?;
alarm.soundName = @"alarm.caf";
alarm.alertBody = @"hi there";
[app scheduleLocalNotification:alarm];
}
我需要将本地通知编程为以下一种可能性:
- 从周一到周五每天开火,周六和周日除外
- 每周六和周日开火,没有其他日子
- 每周在同一天重复
我应该为 repeatInterval 使用什么值来完成此操作?
谢谢
【问题讨论】:
标签: iphone ios uilocalnotification