Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allow iphone to sleep while updating ui

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

[UIApplication sharedApplication].idleTimerDisabled = NO;

and it did nothing. I have seen other apps that go to sleep mode even if the ui is being updated. How can I accomplish this?

like image 532
coder Avatar asked Oct 09 '22 19:10

coder


1 Answers

Based on the comments, Are you running your app while attached to Xcode? By default Xcode stops the device going to sleep. If so, just disconnect and run, it should go to sleep (provided your devices sleep timer is not too much)

like image 128
Amit Shah Avatar answered Oct 11 '22 08:10

Amit Shah