Can I cancel the method \"applicationDidEnterBackground?

自古美人都是妖i 提交于 2019-12-06 07:20:15

No you can't override this. The event will always fire but it does give you time to clean up before you move to the background.

Your delegate’s applicationDidEnterBackground: method has approximately five seconds to finish any tasks and return. In practice, this method should return as quickly as possible. If the method does not return before time runs out, your application is terminated and purged from memory. If you still need more time to perform tasks, call the beginBackgroundTaskWithExpirationHandler: method to request background execution time and then start any long-running tasks in a secondary thread. Regardless of whether you start any background tasks, the applicationDidEnterBackground: method must still exit within five seconds

iOS Application Programming Guide

No, you can't override the operating system or the user's button press.

If the user presses the button to send the app into the background, the app goes into the background.

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