I have an app with a sleep timer where the user can select that after a certain duration of time, the app will suspend. Basically what I do is:
Use this code at the start of the app to disable the app timer:
[[UIApplication sharedApplication] setIdleTimerDisabled: YES];
When the sleep timer expires:
[[UIApplication sharedApplication] setIdleTimerDisabled: NO];
Once the the Auto-Lock value in the user preferences is up, the screen dims and the app goes asleep.
It was working fine but no longer for some reason. I'm troubleshooting and have commented out the commands involving setIdleTimerDisabled still it never goes to sleep.
If I test the state of the idleTimer with ([UIApplication sharedApplication].isIdleTimerDisabled) I can see that IdleTimer is not actually disabled so it can't be that.
What else could be preventing a device from sleeping? when app is left without any interaction. My device is running 9.3.3 in case that's useful.