gpt4 book ai didi

iphone - 如何防止我的应用程序在 iPhone 上后台运行

转载 作者:行者123 更新时间:2023-12-03 19:30:47 25 4
gpt4 key购买 nike

有什么方法可以让应用程序在按下主页按钮时退出而不是进入后台吗?出于安全原因,如果应用程序不在后台运行,而是在按下主页时实际关闭,那就更好了。这不是为了用户的安全,而是为了应用程序上的公司数据,因此这不是用户的选择。除了强制退出之外,我找不到任何退出的方法,苹果不鼓励这样做。

最佳答案

参见opting out of background execution在 iPhone 应用程序编程指南中:

"If you do not want your application to remain in the background when it is quit, you can explicitly opt out of the background execution model by adding the UIApplicationExitsOnSuspend key to your application’s Info.plist file and setting its value to YES.

When an application opts out, it cycles between the not running, inactive, and active states and never enters the background or suspended states.

When the user taps the Home button to quit the application, the applicationWillTerminate: method of the application delegate is called and the application has approximately five seconds to clean up and exit before it is terminated and moved back to the not running state."

关于iphone - 如何防止我的应用程序在 iPhone 上后台运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3222463/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com