There are two states in my iPhone application: user interface and game. The game is played using the tilt of the device, so I turned on the automatic sleep mode when the game started:
[[UIApplication sharedApplication].idleTimerDisabled = TRUE;
But as soon as I get back to the user interface, again I want the automatic sleep to be active. So, at the end of the game, I restore it:
[[UIApplication sharedApplication].idleTimerDisabled = FALSE;
After a long game, this led to an immediate darkening of the first screen of the user interface that I go after the game. Therefore, it seems that when the inactivity timer was turned off, he was still calculating the time. And he shot right after the "turn on". How can I fix this problem?
source share