Documentation URL

https://developer.apple.com/documentation/uikit/core_app/managing_your_app_s_life_cycle?language=objc

APP生命周期状态

管理生命周期事件

https://developer.apple.com/documentation/uikit/core_app/managing_your_app_s_life_cycle?language=objc

Launch

初始化APP准备启动;

APP启动时序
执行一次APP配置

Activation

APP显示到前台

准备[ApplicationDelegate applicationDidBecomeActive:]

当APP处于active状态时,回调

[ApplicationDelegate applicationWillEnterForeground:]

如果APP已经处于background,怎会先调用该方法,之后再回调applicationDidBecomeActive:方法;

[ViewController viewWillAppear:]

更新视图内容

[ViewController viewDidAppear:]

在视图出现在屏幕上后回调;

Deactivation

APP处于background,被阻塞;

[ApplicationDelegate applicationWillResignActive:]

首先调用该方法 ;在该过程中会中断app操作和保存用户关键数据;

[ApplicationDelegate applicationDidEnterBackground:]

APP进入background回调该方法;

Background executionTermination