iOS - detect when application exits

后端 未结 2 1160
予麋鹿
予麋鹿 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

    There's a notification UIApplicationDidGoToBackground that fires when the home button is pressed. A similar notification tells you about going back to foreground.

提交回复
热议问题