I am trying to figure out how to fire a local notification on specific days.
I have to use the calendar units, but the explanations I found about them are a stinking piece. Can you guys please explain to me, as if I were five, what intervals they represent?
I have filled the ones I think I know, please correct me if I am wrong and fill the others.
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 = ????????
this is an example of what I need to do:
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];
}
I need to program the local notifications in one of these possibilities:
- to fire every day from monday to friday, except saturday and sunday
- to fire every saturday and sunday and no other day
- to repeat every week at the same day of week
what values should I use for the repeatInterval to accomplish this?
thanks
I believe what you want can’t be done. This question may give more details.
Of course, what you can do is make two separate local notifications, both set to repeat weekly, one that fires on Saturdays and one that fires on Sundays.