自启动以来如何检查iOS设备是否已重新启动

自启动以来如何检查iOS设备是否已重新启动

本文介绍了自启动以来如何检查iOS设备是否已重新启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望了解人们对此提出了哪些建议.基本上,我想知道自从我的应用程序最后一次启动以来,实际设备是否已经重新启动.人们使用什么方法来发现这一点? (如果有的话?)

Looking to see what people have come up with for this. Basically I want to know if the actual device has been rebooted since my app was last launched. What methods do people use to find this out? (If any?)

我已经考虑过使用mach_absolute_time,但这仍然是不可靠的方法.

I've considered using mach_absolute_time but this is still an unreliable method.

欢呼

推荐答案

不确定这是否是您想要的,但请看一下:

Not sure sure if this is what you wanted but have a look at this:

https://github.com/pfeilbr/ios-system-uptime

在此示例中,作者从内核任务过程中获取了它.

In this example the author fetches it from the kernel task process.

或者您可以看一下mach_absolute_time路线,有一个官方的Apple Q& A,目标类似 https://developer.apple.com/library/mac/#qa/qa1398/_index.html

Or you could look take the mach_absolute_time route, there is an official Apple Q&A with a similar aim https://developer.apple.com/library/mac/#qa/qa1398/_index.html

希望这会有所帮助.

这篇关于自启动以来如何检查iOS设备是否已重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 05:17