如何知道应用是否被用户或iOS终止(10分钟后的背景) [英] How to know whether app is terminated by user or iOS (after 10min background)

查看:123
本文介绍了如何知道应用是否被用户或iOS终止(10分钟后的背景)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何知道应用是否由用户或iOS的终止时重新启动应用程序>

How to know whether app is terminated by user or by iOS when restart app>

通过用户的手段,通过双击主页按钮和pressing - 按钮。用户杀死

'By user' means "by Double-clicking Home Button and pressing - button". killed by user

通过iOS的手段的应用程序成为后台运行状态,而iOS经过10分钟终止应用程序

'By iOS' means "app become background running state, and iOS terminate app after 10 mins"

推荐答案

如果系统资源不足的iOS可能会终止你的应用程序 - 如果发生这种情况,你会看到 applicationWillTerminate

iOS might terminate your app if system resources are low - if this happens, you will see applicationWillTerminate.

它曾经是,如果用户杀死应用程序(任务管理器,通过双击按钮,然后点击红色的 - ),这是一个SIGKILL和applicationWillTerminate不叫。报告在2013年年中建议这种情况已经改变和 applicationWillTerminate 现在被调用。

It used to be that if a user killed the app (task manager, via the button double-click and then hits the red '-') it's a SIGKILL and applicationWillTerminate is not called. A report mid-2013 suggests this has changed and applicationWillTerminate now is called.

您可以使用NSUserDefaults的写在 applicationWillTerminate 一些状态位要注意,此函数被调用和presumably这是一个系统毁伤而不是用户击杀。

You could use NSUserDefaults to write some state bit in applicationWillTerminate to note that this function was called and presumably that's a system kill rather than a user kill.

这篇关于如何知道应用是否被用户或iOS终止(10分钟后的背景)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆