gpt4 book ai didi

iOS 10 用户通知不允许按时间间隔重复通知

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

http://www.openradar.me/26855019

借助新的 iOS 10 用户通知框架,人们无法再在每分钟或每小时重复的特定日期或时间安排通知。

如何在用户通知框架中做到这一点?

最佳答案

我发现了这个:

https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/SchedulingandHandlingLocalNotifications.html#//apple_ref/doc/uid/TP40008194-CH5-SW1

您可以尝试为 UNNotificationResponse 定义类别,然后根据类别类型处理响应。

func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void) {
if response.notification.request.content.categoryIdentifier == "TIMER_EXPIRED" {
// Handle the actions for the expired timer.
if response.actionIdentifier == "SNOOZE_ACTION" {
// Invalidate the old timer and create a new one. . .
}
else if response.actionIdentifier == "STOP_ACTION" {
// Invalidate the timer. . .
}
}

// Else handle actions for other notification types. . .
}

关于iOS 10 用户通知不允许按时间间隔重复通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50484631/

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