UIApplicationDelegate里面最常用的几个函数执行顺序小结

xiaoxiao2021-02-27  270

(1)点击桌面图标正常启动App或者杀死进程后点击推送消息启动App复制代码1.application:willFinishLaunchingWithOptions2.application:application:didFinishLaunchingWithOptions3.applicationDidBecomeActive4.application:didRegisterForRemoteNotificationsWithDeviceToken复制代码 

(2)拖下通知中心/双击Home键使App界面上移applicationWillResignActive 

(3)拖上通知中心/使App界面恢复原位applicationDidBecomeActive 

(4)按Home键使App进入后台1.applicationWillResignActive2.applicationDidEnterBackground 

(5)点击App图标,使App从后台恢复至前台1.applicationWillEnterForeground2.applicationDidBecomeActive 

(6)点击通知中心里面的远程推送,使App从后台进入前台1.applicationWillEnterForeground2.application:didReceiveRemoteNotification3.applicationDidBecomeActive 

(7)按住减号图标杀死App进程applicationWillTerminate 

(8)从APP切换到微信之类的其他应用之后,再切换回来时1.applicationWillEnterForeground2.application:openURL:sourceApplication3.applicationDidBecomeActive 注:当程序处于后台时,点击推送消息进入前台会执行application:didReceiveRemoteNotification,但直接点击推送消息启动App是不会执行该didReceiveRemoteNotification的,在didFinishLaunchingWithOptions的options里面已经有数据表明当前是直接启动还是点击推送消息启动,localNotification与remote类似,略。

转载请注明原文地址: https://www.6miu.com/read-2678.html

最新回复(0)