ios - 本地通知限制

标签 ios swift uilocalnotification

我知道 Apple 将本地通知的数量限制为 64。在阅读了 Apple 的文档、SO 和博客上的一些帖子之后……我有点困惑。

是吗:

  1. 您总共只能为该应用安排 64 条通知。
  2. 一次不能安排超过 64 个通知。(做 他们会在 fireDate 之后自动删除吗?

最佳答案

设备上的每个应用仅限于 64 个预定的本地通知(不是来自服务器的通知)。

通知会在您打开应用时重置,因此您可以在每次关闭应用后再次发送 64。

The system discards scheduled notifications in excess of this limit, keeping only the 64 notifications that will fire the soonest. Recurring notifications are treated as a single notification.

为每个通知提供不同的“requestWithIdentifier”并尝试,可能对您有用。

UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:@"youridentifier" content:objNotificationContent trigger:trigger];
UNUserNotificationCenter *userCenter = [UNUserNotificationCenter currentNotificationCenter];
[userCenter addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) {
    if (!error) {
        NSLog(@"Local Notification succeeded");
    } else {
        NSLog(@"Local Notification failed");
    }

}];

关于ios - 本地通知限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45601375/

相关文章:

ios - SwiftUI 静态列表奇怪的重用行为

ios - [NSCFArray 长度] : unrecognized selector sent to instance

ios - swift -addConstraint : Cannot convert expression's type (constraint: [AnyObject] )' to type ' StringLiteralConvertible'

javascript - 使用云代码 Swift 保存到 PFUser

ios - 在 Xcode 项目中找不到 Firebase 文件

ios - 如何在iOS 10上覆盖WKWebView的 "Save Image"菜单

ios - 在 WKWebView 中打开 Vimeo 视频

ios - 我的应用程序一直提供 UILocalNotifications,即使代码中没有

ios - Reminders 应用程序如何知道只在提醒当天跟踪我的位置?

iphone - 按日期从 iPhone 中删除本地通知