iOS how to detect when app was removed from process

后端 未结 4 1713
感动是毒
感动是毒 2020-11-28 14:57

What is the delegate method for detecting when application was closed.

I mean when user tap this button:

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-28 15:37

    You can't. When your app is killed in this manner, it is not told anything. The app is killed by the OS with no warning of any kind.

    When your app enters the background, you have no way to know if will be started fresh or simply return to the foreground. Therefore you must properly handle things when the app enters the background.

    When the app starts again, restore whatever state you need.

提交回复
热议问题