I am using this in my appdelegate\'s applicationDidFinishLaunching: method to make sure the iPhone doesn\'t go to sleep during the time the app is open
[appl
i had the same problem. i need to make the screen dim, but when turn off the camera, the iphone goes to sleep.
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
}
Then i call it after turn on/off the camera, it works.
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];