gpt4 book ai didi

ios - 通知横幅样式 iOS

转载 作者:行者123 更新时间:2023-11-28 11:40:53 27 4
gpt4 key购买 nike

我知道有类似的问题。我也看到了 this一。很好的答案,但我想澄清两个细节。

  1. 有什么方法可以在代码中检查用户使用“临时”还是“持久”应用的哪种通知横幅样式?

  2. 当 iPhone 被锁定并且用户收到来自“提醒”的通知,然后解锁 iPhone 并再次锁定它时,通知仍会出现在锁定的屏幕上。如果我们对另一个具有“持久”横幅样式的应用程序执行相同的操作,则当 iPhone 再次锁定时,通知将不会仍然出现。那么,我们如何才能实现像 Apple 的 Reminders 应用程序中那样的通知横幅行为呢?

最佳答案

Is there any way to check in code which kind of notification's banner style user use for your app "Temporary" or "Persistent"

当然。调用 UNUserNotificationCenter getNotificationSettings。结果是一个 UNNotificationSettings,其 alertStyle.banner [temporary] 或 .alert [persistent](或 .none,当然)。

When iPhone is locked and user received notification from Reminders, then unlocked iPhone and locked it again, the notification will still appears on locked screen. If we do the same with another app that have "Persistent" banner style, the notification will not still appears when iPhone will locked again.

我不认为锁定屏幕中的行为与“持久”设置有任何关系。我认为对于允许锁屏通知的任何应用程序,如果您所做的只是打开屏幕(从黑色到锁定屏幕)并查看它,然后再次关闭屏幕,如果有通知可见,它将下次您做同样的事情时可见。

关于ios - 通知横幅样式 iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53697020/

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