gpt4 book ai didi

ios - UNNotification 本地通知和请勿打扰

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

Sleep Cycle 应用程序设法发送本地通知并播放声音,即使我在手机上启用了“请勿打扰”。

你是怎么做到的?

最佳答案

好吧,可以通过在配置本地通知时启用 UNNotificationSetting 中的“严重警报”属性来实现。

Apple 文档 - https://developer.apple.com/documentation/usernotifications/unnotificationsettings/2963116-criticalalertsetting

When UNNotificationSetting.enabled, this property authorizes the app to play critical sounds that ignore Do Not Disturb and the device’s mute switch.

For local notifications, the system attempts to play a critical sound when the sound property of the UNNotificationContent object contains an object returned by the defaultCritical property, the criticalSoundNamed(_:) method, or a related method.

For remote notifications, the system attempts to play a critical sound when the notification’s payload contains a sound directory that contains the critical key.

Critical alerts require a special entitlement issued by Apple.

关于ios - UNNotification 本地通知和请勿打扰,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55040319/

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