我UILocalNotification
用于警报目的。我有一个基于工作日(周日、周一、周二、周三、周四、周五、周六)重复的自定义选项。很多应用程序都完成了这个过程。我尽力了我的水平。但我无法让它工作。请大家帮帮我......
问问题
16397 次
2 回答
25
您不能使用UILocalNotification设置自定义重复间隔。之前已经提出过这个问题(见下文),但只提供了有限的选项。repeatInterval 参数是一个枚举类型,它仅限于特定的值。
您不能将这些枚举相乘并获得这些间隔的倍数。您的应用中设置的本地通知不能超过 64 个。除非用户选择在通知触发时运行您的应用程序(他们可能不会运行它),否则您无法在通知触发后重新安排它。
此处发布了对重复间隔乘数的请求。您可以为其添加评论。我建议向 Apple 提交错误报告或功能请求(网址?)。
于 2011-08-06T12:03:36.553 回答
2
只需使用参数间隔和工作日创建一个方法。并且每次你必须设置闹钟时调用该函数。但是工作日的通知要单独解决。正如我调用的方法如下所示:
[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,周二为 3,依此类推。
I hope it will help u...!
于 2012-04-05T09:06:36.310 回答