gpt4 book ai didi

ios - UIApplicationDidBecomeActiveNotification 通知在第一次运行应用程序时未触发

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:42:20 27 4
gpt4 key购买 nike

我在init方法和viewDidLoad方法中都调用了这行代码。但是,方法 applicationDidBecomeActiveNotification 永远不会在我第一次运行该应用程序时触发。它仅在我运行一次后运行。

 [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationDidBecomeActiveNotificationAction)
name:UIApplicationDidBecomeActiveNotification
object:nil];

这样对吗?有没有办法在我第一次运行应用程序时通知我的 viewController UIApplicationDidBecomeActiveNotification。

最佳答案

第一次运行APP时不会触发

UIApplicationDidBecomeActiveNotification

Posted when the application becomes active.
An application is active when it is receiving events. An active application can be said to have focus. It gains focus after being launched, loses focus when an overlay window pops up or when the device is locked, and gains focus when the device is unlocked.

您可以在APP初始化后自行触发。

关于ios - UIApplicationDidBecomeActiveNotification 通知在第一次运行应用程序时未触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17375649/

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