-1

I have an app and this app has a setting for Sleep mode (Sleep mode on / off)

For Sleep mode 'on', I have this code :

[UIApplication sharedApplication].idleTimerDisabled = NO;

But Sleep mode is not working. Of course, the device setting 'Auto-Lock' is 1 Minute.

I want to know how to enable sleep mode.

Marc
  • 6,051
  • 5
  • 26
  • 56
dh0rmfpdlxm
  • 301
  • 1
  • 3
  • 16
  • So, the device doesn't go to sleep after 1 minute like you expect it to? Is the device charging? – FreeNickname Feb 26 '16 at 09:19
  • As far as I know apple doesn't allow to do this because of security issue – SRI Feb 26 '16 at 09:24
  • 1
    Are you running the App thought Xcode debugger? Debugger does not allow phone to go to sleep as you are debugging. Try disconnecting the device and starting the App on the iPhone itself. – UditS Feb 26 '16 at 09:32
  • oh! thank you. it was debug mode. thank you – dh0rmfpdlxm Feb 29 '16 at 00:36

1 Answers1

0

You cannot make the device sleep when you want to, you can just enable or disable the usual device timer.

Here, check this - Click me

Community
  • 1
  • 1
Pulkit Sharma
  • 545
  • 1
  • 6
  • 19