UILocalNotification自定义闹钟的重复间隔(星期日,星期一,星期二,星期三,星期四,星期五,星期六)



我使用UILocalNotification用于报警目的。我有一个基于工作日(周日,周一,周二,周三,周四,周五,周六)的自定义选项。很多应用程序都做了这个过程。我尽了最大的努力。但我不能让它工作。请大家帮帮我....

您不能使用UILocalNotification设置自定义重复间隔。以前也有人问过这个问题(见下文),但只提供了有限的选项。repeatInterval参数是一个枚举类型,它被限制为特定的值。

你不能将这些枚举相乘并得到这些区间的倍数。你不能在你的应用程序中设置超过64个本地通知。你不能在通知触发后重新调度通知,除非用户选择在通知触发时运行你的应用程序(他们可能不运行它)。

这里有一个重复间隔乘数的请求。您可以在其中添加注释。我建议向苹果提交bug报告或功能请求(url?)。

  • 如何设置本地通知重复时间间隔为自定义时间间隔?
  • UILocalNotification的自定义重复间隔
  • 自定义UILocalNotification重复间隔
  • UILocalNotification重复
  • UILocalNotification中的非固定repeatInterval
  • 我可以自定义UILocalNotification重复间隔(即只在工作日?)
  • 使用间隔重复UILocalNotifications
  • 在一周的某些天重复UILocalNotification

简单地创建一个带有interval和weekday参数的方法。并调用该功能每次都可以设置闹钟。但是对于工作日另行安排。我把这个方法称为下面给出:

            [self notificationWithItem:tempDict Date:[self SetDateForAlarmWithWeekday:2 :tempDict] andRepeatInterval:NSWeekCalendarUnit];
            [self notificationWithItem:tempDict Date:[self SetDateForAlarmWithWeekday:3 :tempDict]andRepeatInterval:NSWeekCalendarUnit];
            [self notificationWithItem:tempDict Date:[self SetDateForAlarmWithWeekday:4 :tempDict] andRepeatInterval:NSWeekCalendarUnit];
            [self notificationWithItem:tempDict Date:[self SetDateForAlarmWithWeekday:5 :tempDict] andRepeatInterval:NSWeekCalendarUnit];
            [self notificationWithItem:tempDict Date:[self SetDateForAlarmWithWeekday:6 :tempDict] andRepeatInterval:NSWeekCalendarUnit];

我将一周中不同日子的weekday参数传递为2 for星期一,星期二3,依此类推。

I hope it will help u...!

相关内容

最新更新