UILocalNotification 中的非固定重复间隔

发布于 2024-11-06 22:09:19 字数 606 浏览 1 评论 0原文

几周来我一直在为这个问题绞尽脑汁。

如果我将 UILocalNotificationrepeatInterval 属性设置为非固定间隔,会发生什么情况? (非固定是指诸如 NSWeekdayCalendarUnitNSWeekdayOrdinalCalendarUnit 之类的单位)。

假设我将 UILocalNotificationfireDate 设置为本周的星期三,并将 repeatInterval 设置为 NSWeekdayCalendarUnit< /代码>。每个星期三都会重复吗?

NSWeekdayOrdinalCalendarUnit 也是如此吗?因此,如果我收到一个将 fireDate 设置为该月第四个星期三的通知,并且将 repeatInterval 设置为 NSWeekdayOrdinalCalendarUnit,将会每个月的第四个星期三重复一次?

先感谢您。

I've been cracking my head on this one for weeks now.

What happens if I set the repeatInterval property of a UILocalNotification to be a non-fixed interval? (by non-fixed I mean units such as NSWeekdayCalendarUnit and NSWeekdayOrdinalCalendarUnit).

So say I have UILocalNotification with its fireDate set to the Wednesday in the current week, and I set the repeatInterval to be NSWeekdayCalendarUnit. Will it repeat every Wednesday?

Is the same true for NSWeekdayOrdinalCalendarUnit? So if I have a notification with the fireDate set to be the 4th Wednesday of the month, and I set the repeatInterval to be NSWeekdayOrdinalCalendarUnit, will it repeat every 4th Wednesday of every month?

Thank you in advance.

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

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

发布评论

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

评论(1

人间☆小暴躁 2024-11-13 22:09:19

好的,为了大家的利益,这是我发现的:

  • 将重复间隔设置为 NSWeekdayCalendarUnit 并不能按我的预期工作,相反,我想它会查找内部该工作日的每次出现一周,并且因为只有一个,所以它会安排该周结束时的通知(默认为星期六)

  • 以类似的方式,将其设置为 NSWeekdayOrdinalCalendarUnit 会创建类似的行为,因为看到 X 天的 X 序数不再出现,它会诉诸于调度到一个月中该工作日的 las 序数。

OK, for the benefit of everyone, here's what I found:

  • Setting the repeat interval to NSWeekdayCalendarUnit doesn't work how I expected, instead, I suppose it looks for every occurrence of that weekday inside a week, and because there is only one, it then schedules the notification for the end of that week (the default is Saturday)

  • In a similar way, setting it to NSWeekdayOrdinalCalendarUnit creates a similar behavior, in that, seeing that there is no more occurrences of X ordinal of X day, it resorts to scheduling to the las ordinal for that weekday in a month.

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