Disable automatic screen lock in iOS 5.1

Just setting [UIApplication sharedApplication].idleTimerDisabled = YES; in

- (BOOL) application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions

works well for me. However, there is a caveat. I have noticed that every time I invoke camera utility to take a snapshot, idleTimerDisable gets set to NO behind the scene. So right after I upload my image, I had to call the following line of code again:

[UIApplication sharedApplication].idleTimerDisabled = YES;

I would not be surprised if there are more places throughout that require same strategy. So far this approach has worked without issues for me.

Leave a Comment