My App needs to trigger alarms at weekdays only.
My idea was to schedule notifications for each day, but the problem is that I read that 64 scheduled notifications are the maximum you can have and with my notifications there will be a total of 120 notifications so this can’t be done.
Now I’m wondering if there is a way to cancel all the notifications on Saturday and Sunday instead.
The code I am using now that repeats the notification in weekends to:
NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setHour:8];
[comps setMinute:25];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDate *fireDate = [gregorian dateFromComponents:comps];
UILocalNotification *alarm = [[UILocalNotification alloc] init];
alarm.fireDate = fireDate;
alarm.repeatInterval = NSDayCalendarUnit;
alarm.soundName = @"sound.aiff";
alarm.alertBody = @"Message..";
alarm.timeZone = [NSTimeZone defaultTimeZone];
[[UIApplication sharedApplication] scheduleLocalNotification:alarm];
Look at
[UIApplication scheduledLocalNotifications], you have all notification scheduled.It’s an array of
UILocalNotification.Make a loop with this array and look at the date
fireDateof the notification, and do :