自定义警报的 UILocalNotification 重复间隔(周日、周一、周二、周三、周四、周五、周六)

发布于 2024-11-28 03:11:50 字数 139 浏览 1 评论 0原文

我使用 UILocalNotification 来实现警报目的。我有一个基于工作日(周日、周一、周二、周三、周四、周五、周六)重复的自定义选项。很多应用程序都执行了这个过程。我尽力了我的水平。但我无法让它发挥作用。请大家帮帮我......

I'm using UILocalNotification for Alarm Purpose. I have a custom option for repeat based on weekdays (sun, mon, tue, wed, thu, fri, sat). So many applications did this process. I tried My level best. But I can't get it to work. Please you guys help me....

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

还不是爱你 2024-12-05 03:11:50

您无法使用 UILocalNotification< 设置自定义重复间隔/a>.之前已经有人问过这个问题(见下文),但只提供了有限的选项。 repeatInterval 参数 是一个枚举类型,它限制为 具体值

您无法将这些枚举相乘并获得这些间隔的倍数。您的应用程序中设置的本地通知不能超过 64 个。一旦通知触发,您就无法重新安排通知,除非用户选择在通知触发时运行您的应用程序(他们可能不会运行它)。

此处发布了重复间隔乘数的请求。您可以添加评论。我建议向 Apple 提交错误报告或功能请求(url?)。

You cannot set custom repeat intervals with UILocalNotification. This has been asked before (see below) but only limited options are provided. The repeatInterval parameter is an enum type and it limited to specific values.

You cannot multiply those enumerations and get multiples of those intervals. You cannot have more than 64 local notifications set in your app. You cannot reschedule a notification once it fires unless the user chooses to run your app when the notification fires (they may not run it).

There is a request for repeat interval multipliers posted here. You can add comments to it. I suggest filing a bug report or feature request (url?) with Apple.

披肩女神 2024-12-05 03:11:50

只需创建一个带有参数间隔和工作日的方法。并打电话
每次您必须设置闹钟时都会使用该功能。但是通知
工作日要单独结算。正如我所说的方法
如下:

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

我将一周中不同日期的工作日参数传递为 2
星期一,3 表示星期二,依此类推。

我希望它能帮助你......!

Simply make a methods with parameters interval and weekday. And call
the function every time u have to set alarm.But the Notifications for
weekdays are to be settled separately.As I have called the method as
given below:

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

I passed weekday parameter for different days of week as 2 for
monday,3 for tuesday and so on.

I hope it will help u...!
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文