Swift4 Terminal Sleep Count

Asked 2 years ago, Updated 2 years ago, 75 views

I am currently using Swift4, but I would like to get the number of sleep on my device.I understand that you write the code with AppDelegate.swift when you sleep or start the app.What kind of code should I use to get the number of sleep on the device instead of the app?If you don't mind, please let me know.

swift swift4

2022-09-30 18:41

1 Answers

It's usually impossible.The iOS app basically runs only when the application is in the foreground, and the background can only run for a very limited amount of time.

Although only a few applications can operate in the background exceptionally long periods of time, there is basically no API to get device sleep timing.

Therefore, it is usually impossible to create such an app.


2022-09-30 18:41

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.