【发布时间】:2012-11-14 01:05:42
【问题描述】:
我的应用只需要在工作日触发警报。 我的想法是安排每天的通知,但问题是我读到 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];
【问题讨论】:
-
当您使用日期/时间初始化通知时,您可以随时查看工作日。你能告诉我你设置通知的代码吗?
-
@anatoliy_v 请查看我的第一个更新帖子,提前致谢。
标签: objective-c ios uilocalnotification