auto-lock iphone/ipad programmatically
Is there a way to 'force' the user to have auto-lock (and maybe passcode lock) on whil开发者_如何学Pythone the application is running (for security reasons mainly)? If we can't set them programmatically, can we at least check to see if they are set?
Thanks, Mihai
if ([UIApplication sharedApplication].idleTimerDisabled == YES) {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Please enable auto-lock"...];
[alert show];
[alert release];
} else {
/* some code */
}
The above snippet will check to see if the idle timer is disabled. If it is, it will tell the user to enable it via a UIAlertView.
YOu can use a Session handler class which inherits from UIApplication and fix a timer.. Thats very easy and fully customizable.
精彩评论