Using `NSProcessInfo.systemUptime` to Detect Device Restarts: Feasibility and Background Considerations

"We are developing an application use case that requires us to prompt the user to restart their device. We plan to use the system uptime value provided by [NSProcessInfo processInfo].systemUptime to determine if a restart has occurred. Apple's documentation defines this API as 'The amount of time the system has been awake since the last time it was restarted.'

Our questions are:

Can we reliably use this API, in conjunction with persistent storage, to detect a device restart?

Are there any known limitations or considerations when accessing or relying on this API while the application is running in the background?"

Answered by DTS Engineer in 868640022
Can we reliably use this API … to detect a device restart?

No. You could probably make it work a lot of the time, but it definitely won’t be completely reliable.

I explain a better option in this post.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Can we reliably use this API … to detect a device restart?

No. You could probably make it work a lot of the time, but it definitely won’t be completely reliable.

I explain a better option in this post.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Using `NSProcessInfo.systemUptime` to Detect Device Restarts: Feasibility and Background Considerations
 
 
Q