IOS - setIdleTimerDisabled: NO Not Working

I have an application that uses a camcorder, so the screen cannot be dim. Screen inhibition from dimming works like this:

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

However, when the application is closed and enters the background, setting IdleTimer back to NO does not work. The screen remains forever on the main screen. This is how I try to do it.

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

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

+5
source share
3 answers

The same thing happened to me. It actually works, but only works when your device is not connected to xCode. Try turning off the device, and then test this functionality.

+9
source

applicationWillEnterForeground

delegegate.

, .

0

Quick version:

public func applicationWillResignActive(application: UIApplication) {
    UIApplication.sharedApplication().idleTimerDisabled = false
}


public func applicationDidBecomeActive(application: UIApplication) {
    UIApplication.sharedApplication().idleTimerDisabled = true
}
-1
source

All Articles