- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
因为 UILocalNotification
现已弃用,我将我的代码移至新的 UNNotificationRequest
API。
它声明:'cancelLocalNotification' 在 iOS 10.0 中被弃用:使用 UserNotifications Framework 的 -[UNUserNotificationCenter removePendingNotificationRequestsWithIdentifiers:]
但它似乎不相等 - 虽然我可以随时使用 cancelLocalNotification
删除消息(即使它们已显示/发送),但似乎 removePendingNotificationRequestsWithIdentifiers
只会删除未送达的通知。这真的很烦人。
所以我的问题是:有没有一种有效的方法可以删除使用 UNNotificationRequest
排队的通知,或者我应该忽略那些弃用警告?
最佳答案
您还可以使用 removeDeliveredNotifications(withIdentifiers:)
函数从通知中心删除已发送的通知。有关详细信息,请参阅 documentation
关于ios - 取消 UNNotificationRequest,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45635400/
由于 UILocalNotification 在 iOS10 中已被弃用,我无法理解如何将以下代码更新到 UNNotificationRequest 框架。我基本上让用户在他们选择的时间安排每日通知。
因为 UILocalNotification 现已弃用,我将我的代码移至新的 UNNotificationRequest API。 它声明:'cancelLocalNotification' 在 iO
我这样调用本地通知 let center = UNUserNotificationCenter.current() let content = UNMutableNotificationContent
到目前为止,在将 UNNotificationRequest 添加到包含 UNTimeIntervalNotificationTrigger 的 UNUserNotificationCenter 之后
我正在实现自定义重复提醒,例如默认提醒应用。这里我不介绍如何设置重复间隔,例如每第 N 天/周/月/年触发,即从现在起每 4 天/周/月/年触发通知。 这是我对 interval = 1 的实现
以前,我在我的应用程序中使用 UILocalNotification 进行提醒。 但由于上述 API 在 iOS 10.0 中已弃用,现在需要使用 UserNotifications Framewor
我正在使用 UNNotificationRequest,我希望在单击按钮时立即弹出通知。但在这种情况下,它会在我退出应用程序时出现。这是我的代码 @IBAction func shortNotifBt
我试图找到 UNNotificationRequest 对象的预定触发日期。 我正在像这样获取待处理的通知请求: UNUserNotificationCenter.current().getPendi
更新: 我需要找到下一个通知请求和关联的 ID,所以我最终这样做了: UNUserNotificationCenter.current().getPendingNotificationRequ
我的应用正在下载一个 .wav 文件并将其移动到 Library/Sounds,然后使用该声音的文件名通过 UNNotificationRequest 安排本地通知。此请求按预期发送通知,但我添加的自
我目前正在使用 Swift 4 开发一个包含本地通知的应用程序。当用户点击通知(如呈现特定的 ViewController)时,我试图运行一段特定的代码。我找不到关于堆栈溢出的答案,因为 App de
我有一组 UNNotificationRequest。我想按 nextTriggerDate 对它们进行排序。 据我所知,我会使用 array.sorted(by:predicate) 对数组进行排序
我知道 UILocalNotification 的本地通知限制是 64。它写在Apple Dev Docs .但是 UILocalNotification 在 iOS 10 中被弃用了。Apple 建
自定义声音在 unnotificationrequest 中不起作用 - iOS 10 我试过了: [UNNotificationSound soundNamed:@"Alarm.mp3"] 或 [U
我想在 iOS 10 上使用 UserNotificationFramework 向自己发送仅数据通知——即,没有面向用户的文本或声音。基本上是将其用作持久计时器,以便能够触发应用程序(如果在应用程序
我有一个函数可以设置 UNNotificationRequest传入一些参数后,我将这些参数放入 userInfo 中这样我就可以取回它们并在打开本地通知时使用它们。它的打印显示我正在分配传入的正确值
我正在尝试获取有关本地通知的待处理通知请求。它抛出我的错误:“从'(_) throws -> Void'类型的抛出函数到非抛出函数类型'([UNNotificationRequest]) -> Voi
我是一名优秀的程序员,十分优秀!