gpt4 book ai didi

ios - 使用条件和限制安排 future 的 UNUserNotificationCenter (iOS)

转载 作者:行者123 更新时间:2023-11-28 19:25:15 24 4
gpt4 key购买 nike

我知道这个问题已经被问过好几次了,但我没有找到具体的解决方案。我正在开发 iOS 应用程序,我正在使用 userNotification,一切正常,但我必须使用循环/重复通知所以这里是我必须满足的条件,想知道如何

Case: Show notification to user to check for specific task if it is completed.

  1. 每天显示通知,直到指定日期到达
  2. 每周一显示通知,直到指定日期到达
  3. 每月每隔指定的一天显示通知,直到指定日期到达

Problem:

  1. 我不知道如何安排给定条件的重复通知
  2. 每个应用程序的通知数量是否有限制?假设我有 100 个任务,每个任务都可能有任何受上给定条件限制的通知。

请告诉我可以做什么?以及我如何满足我的要求。

最佳答案

show notification everyday until specified date is arrived

这是在每天的特定时间显示一条消息

    var dateComponents = DateComponents()
dateComponents.hour = 10
dateComponents.minute = 30
let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: true)

if trigger.nextTriggerDate() >= your_specified_date {
return
}

Is there any limit of notification per app? suppose I have 100 of task and each task may have any of the notification bounded with the uppar given conditions.

Yes, there are limits .系统保留最快触发的 64 个通知(自动重新安排的通知计为一个通知)并丢弃其余的。

关于ios - 使用条件和限制安排 future 的 UNUserNotificationCenter (iOS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59411003/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com