[UIApplication sharedApplication].idleTimerDisabled = YES;
To save the battery, you should turn off the idle timer only when necessary (for example, when the user is playing, but not when viewing the menu).
So it’s better to put this code in the function of onEnteryour game layer, and then add
[UIApplication sharedApplication].idleTimerDisabled = NO;
to your onExit function
Sergi source
share