When App Delegate's method willTerminate is executed?

☆樱花仙子☆ 提交于 2019-12-02 04:37:11

What is not clear to me is when method applicationWillTerminate is executed

Almost never. It can be called under certain rare circumstances where you are e.g. playing music in the background and are terminated from there. But in general you should expect that it will never be called, because by the time you are terminated, you are already suspended and your code is no longer running (and the system is not going to wake you up just to tell you it's killing you in the background).

One time that applicationWillTerminate will execute is when a user touches (once or twice) the Home button and then slides the app off the screen.

Personally I do this regularly since I touch the Home button to switch between regularly used apps that I want to make active, rather that finding them in my 9 pages of icons.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!