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
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.
© 2024 OneMinuteCode. All rights reserved.