UIApplicationDidBecomeActiveNotification
-
官方翻译:An app is active when it is receiving events. An active app 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.
在应用程序激活时发布。应用程序在接收事件时处于活动状态。 可以说一个活动的应用程序具有焦点。 它在启动后会获得焦点,在弹出窗口或锁定设备时会失去焦点,而在解锁设备时会获得焦点。 -
UIApplicationDidBecomeActiveNotification触发时机
-
1.在App中触发系统弹窗(如内购弹窗)-再回到App,触发
-
2.App启动
-
3.重新进入前台
image.png
-
UIApplicationWillEnterForegroundNotification
- 触发时机
- 只有重新进入前台
UIApplicationDidBecomeActiveNotification和 UIApplicationWillEnterForegroundNotification
- 调用时机不同,如上。
- 重新进入前台时都会触发,但UIApplicationWillEnterForegroundNotification 是要早于 UIApplicationDidBecomeActiveNotification。
网友评论