[英]How to check programmatically whether the Scheduled Summary notifications is enabled by a user for an iOS app?
In iOS 15, Apple has introduced Scheduled Summary notifications .在 iOS 15 中,Apple 引入了计划摘要通知。 We can schedule select app notifications to be delivered at a specific time of the day alongside others apps as a bundle.
我们可以安排 select 应用程序通知在一天中的特定时间与其他应用程序一起作为捆绑交付。 Is there a way to find whether the user has enabled this notification feature for an app programmatically?
有没有办法找出用户是否以编程方式为应用启用了此通知功能?
You can check if scheduled summary notifications are enabled or not this way:您可以通过以下方式检查是否启用了计划的摘要通知:
let current = UNUserNotificationCenter.current()
current.getNotificationSettings(completionHandler: { permission in
DispatchQueue.main.async {
if #available(iOS 15.0, *) {
switch permission.scheduledDeliverySetting {
case .enabled:
// Show alert or do something
break
default:
// Do nothing
break
}
}
}
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.