问题描述
我的测试,当我退出(通过按主页按钮)我的应用程序时,由于多任务处理功能,它仍然在后台运行".但是,我希望它在按下主页按钮时退出.这只发生在我身上吗?
I my testing, when I exit (by pressing the home button) my app, it still is "running" in the background, thanks to the multitasking feature. However, I would like it to quit when the home button is pressed. Is this only happening to me?
无论如何,我已将其追溯到应用委托中的 applicationWillResignActive
和 applicationDidBecomeActive
方法.这些被称为多任务处理,但是当我想终止时,应用程序退出活动".非常感谢有关此问题的任何指导!
Anyway, I have tracked it down to the applicationWillResignActive
and the applicationDidBecomeActive
methods in the app delegate. These get called for multitasking, but when I want to terminate, the app "resigns active." Any guidance on this issue is greatly appreciated!
推荐答案
您的应用程序可以选择退出多任务处理(请参阅 UIApplicationExitsOnSuspend 键到 Info.plist 并将其值设置为 YES.
Your application can opt out of multitasking (see the appropriate section in the iPhone Application Programming Guide) by adding the UIApplicationExitsOnSuspend
key to your Info.plist and setting its value to YES.
实际上,Apple 强烈建议您不要这样做,除非您有充分的理由这样做.
In practice, Apple strongly recommends you not do this unless you have a very good reason for this behavior.
这篇关于按主页时退出应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!