Objective c UILocalNotification:在特定日期取消所有

Objective c UILocalNotification:在特定日期取消所有,objective-c,ios,uilocalnotification,Objective C,Ios,Uilocalnotification,我的应用程序只需要在工作日触发警报。 我的想法是为每天安排通知,但问题是,我了解到64个计划通知是您最多可以拥有的,而我的通知将总共有120个通知,因此无法做到这一点 现在我想知道是否有办法取消周六和周日的所有通知 我现在使用的代码在周末重复通知: NSDateComponents *comps = [[NSDateComponents alloc] init]; [comps setHour:8]; [comps setMinute:25]; NSCalendar *g

我的应用程序只需要在工作日触发警报。 我的想法是为每天安排通知,但问题是,我了解到64个计划通知是您最多可以拥有的,而我的通知将总共有120个通知,因此无法做到这一点

现在我想知道是否有办法取消周六和周日的所有通知

我现在使用的代码在周末重复通知:

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];

查看
[UIApplication scheduledLocalNotifications]
,您已经安排了所有通知

它是一个
UILocalNotification
数组

使用此数组进行循环,查看通知的日期
fireDate
,然后执行以下操作:

[UIApplication cancelLocalNotification:theNotificationToDelete];

当您在一周内发出带有日期/时间的通知时,您可以随时查看。你能告诉我你在哪里设置通知的代码吗?@anatoliy\u v请查看我的第一篇更新帖子,提前谢谢。谢谢你的回复,但我不知道你的意思。我的通知工作正常,但每天都重复,我希望它在星期六和星期天取消所有通知。您已经提前安排了每天的所有通知?我刚刚创建了24个通知,并将重复设置为每天,因为苹果的限制,我无法安排120次通知。我理解,但你可以使用for循环而不是daily参数来安排每天的通知。你有什么示例代码可以实现这一点,我应该从哪个方向开始编码?