Allow iphone to sleep when updating ui

I am writing a music player that I am trying to allow to enter sleep mode. The problem is that ui is updated every second, and I think this is preventing the phone from sleeping. I added this line:

[UIApplication sharedApplication].idleTimerDisabled = NO;

and he did nothing. I saw other applications that go into sleep mode, even if ui is updated. How can i do this?

+5
source share
1 answer

Based on the comments, do you launch your application when connected to Xcode? By default, it Xcodestops the device. If so, just disconnect and run, it should sleep (provided that the timers of your device are not too small)

+4
source

All Articles