gpt4 book ai didi

ios - 在显示和关闭 `UIAlertView` 或 `UIAlertController` 时确定应用程序状态

转载 作者:行者123 更新时间:2023-11-28 12:38:22 26 4
gpt4 key购买 nike

当 iOS 中显示隐私警报时(例如要求访问照片),UIApplicationWillResignActiveNotification 会在显示警报时被调用并且应用程序变为非事件状态。然后,当在警报上做出选择并且应用程序恢复时,将调用 UIApplicationDidBecomeActiveNotification。当显示其他警报时也是如此,例如当显示通知警报时,即 registerUserNotificationSettings

但是,当调用 UIAlertViewUIAlertControllerUIApplicationWillResignActiveNotificationUIApplicationDidBecomeActiveNotification 在焦点从应用更改为警报时不会被调用。

Question:

What is going on? What is the equivalent notifications triggered for the application’s inactive and active state when UIAlertView or UIAlertController are displayed and dismissed?

最佳答案

当您自己的代码显式显示一个 UIAlertController(或 UIAlertView)时,没有通知。您的应用已经知道您正在显示警报,因为您刚刚显示了它。

您的应用不会显示其他系统警报,例如隐私警报。它们由 iOS 显示。这就是区别。您的应用未处于事件状态,因为操作系统现在处于事件状态并显示警报。系统警报完成后,您的应用会再次激活。

关于ios - 在显示和关闭 `UIAlertView` 或 `UIAlertController` 时确定应用程序状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40226056/

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