Can the app make the device sleep?

Can I put the iPhone into sleep mode from the application? If so, how can I do this?

Thanks,
Tee

+4
source share
2 answers

Not in the public API. It may be something private, but you will not be able to use it in the app store. The only method I know about hibernation is the ability to turn off sleep while your application is running:

[UIApplication sharedApplication].idleTimerDisabled = YES; 

I think the idea is that the software should not affect the hardware too much, i.e. running, hibernating exiting the application is not up to you, and exiting () with your application manually using the code will be a non-standard practice and Apple frowned. It's nice that your phone will sleep by default after a short period of time.

+7
source

The above is true. The only way to put the iPhone into standby mode is to either wait for idleTimer, or click the "Sleep" button on the device. Any other way, of course, frowned Apple. I believe that this may even fall under the โ€œprivate APIโ€, which means that they can reject it from the repository / approval.

0
source

Source: https://habr.com/ru/post/1304524/


All Articles