简体   繁体   English

如何以编程方式检查用户是否为 iOS 应用程序启用了计划摘要通知?

[英]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.

相关问题 检查 UILocalNotification 弃用后是否启用了用户通知 - Check whether user notifications are enabled after UILocalNotification deprecation 如何以编程方式检查 iOS 应用程序中是否存在键盘? - How can I programmatically check whether a keyboard is present in iOS app? 如何以编程方式检查用户是否已登录到应用商店 - How to check programmatically whether a user is logged in to the app store 如何在 iOS App 中检查 FACEID 是否已被用户禁用? - How to check whether the FACEID has been disallowed by the user in iOS App? 如何从 iOS 的电话设置中检查用户是否启用/检查了自动填充凭据提供程序扩展? - How to check whether user has enabled/checked autofill credential provider extension or not from phone settings in iOS? 以编程方式检测 iOS 密码是否启用 - Programmatically detect whether iOS passcode is enabled or not 如何检查iOS键盘中是否启用了听写功能? - How to check whether Dictation is enabled in iOS Keyboard.? 如何检查 iOS 设备上是否启用了 Motion & Fitness? - How can I check whether or not Motion & Fitness is enabled on an iOS device? 如何检查 iOS/iPadOS 中是否启用了暗模式? - How can I check whether dark mode is enabled in iOS/iPadOS? iOS:如何检查是否启用了应用内购买? - iOS: How to check if In-App purchase enabled?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM