disable automatic locking on iphone with iOS 4.3.3
I want to disable the auto lock on my iOS4.3.3 program. I found on the web the开发者_如何学Go same answer several times for this and working for xcode3 but I cant find it to work with mine.. help pls? thks
This should work on iOS 4.3.3. If not then you're doing something wrong:
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
I did it in a ViewController like this.
-(void) viewDidAppear:(BOOL)animated
{
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
}
-(void) viewDidDisappear:(BOOL)animated
{
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
}
精彩评论