Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS - setIdleTimerDisabled:NO Not Working

I have an app that utilizes the video camera so the screen cannot dim. Inhibiting the screen from dimming works fine like so:

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
}

However when the app is closed and enters the background, setting the IdleTimer back to NO is not working. The screen stays on forever on the home screen. This is how I am trying to accomplish this.

- (void)applicationWillResignActive:(UIApplication *)application
{
    [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
}

Is there a better place to add this line of code?

like image 388
Kevin_TA Avatar asked Jan 24 '13 20:01

Kevin_TA


1 Answers

The same problem was occuring with me. Actually it does work but only works when your device is not connected to xCode. Try disconnecting the device and then test this functionality.

like image 55
Siddhant Avatar answered Oct 23 '22 05:10

Siddhant