ios - 关于如何处理 UNUserNotificationCenter 64 限制的问题

标签 ios swift

我正在尝试制作一个提醒应用程序,并且我所有的通知重复都设置为 true

Example :

var dateComponents = DateComponents()
                dateComponents.weekday = 1
                dateComponents.hour = Int(hour)
                dateComponents.minute = Int(minute)

let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: true)
                    let requestIdentifier = "\(timeArrayToSaveInMobile[indexTime].alarmId!)Sunday"
                    let request = UNNotificationRequest(identifier: requestIdentifier, content: content, trigger: trigger)

我浏览过这里,有些人提到系统保留了最快触发的 64 个通知。 因此,如果我已经达到限制,但我设置了另一个通知,该通知将早于(64 列表)中的某些通知触发,它应该替换其中一个通知,对吗?因为它会比列表中的一些预设通知更早触发。

我的问题与此类似ios 10 swift 3 add more than 64 local notifications does not keep soonest

最佳答案

当您打开应用程序时,通知将重置,因此您可以在每次关闭应用程序后设置/发送另一个 64。

系统会丢弃超出此限制的计划通知,仅保留最快触发的 64 个通知。重复通知被视为单个通知。

在您的示例中,您为星期日设置了一个通知,每个星期日仅计数一个。

关于ios - 关于如何处理 UNUserNotificationCenter 64 限制的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53701073/

相关文章:

json - Swift:将 Alamofire 和 SwiftyJSON 与分页 JSON API 结合使用

iOS - MapKit 相机旋转动画

ios - 当前页面点较大的页面控件不起作用(带滚动的 UIPageControl)

ios - Three.js keepDrawingBuffer 在 iOS 上不起作用

ios - 在 UIButton 上的透明 imageView 图像后面插入 UIVisualEffectView

ios - 带有小数和长度的 Swift TextField 限制

swift - “ fatal error :在展开可选值时意外发现nil”是什么意思?

ios - 如何使用 throw '() throws -> Bool' 转义值不能转换为 'Bool'

ios - 如何为多个类实例创建多个 NSTimer?

swift - 定时器的函数在失效后被调用