iOS - detect when application exits

后端 未结 2 1157
予麋鹿
予麋鹿 2021-01-19 02:33

How can I detect when a user exits the application? (hitting the home button) And how can I detect when the relaunch it? (clicking the icon)

*I\'m not talking about

2条回答
  •  被撕碎了的回忆
    2021-01-19 03:05

    - (void)applicationDidEnterBackground:(UIApplication *)application
    

    and

    - (void)applicationDidBecomeActive:(UIApplication *)application
    

    In your AppDelegate.m

    - (void)applicationWillTerminate:(UIApplication *)application
    

提交回复
热议问题