开发者

auto-lock iphone/ipad programmatically

开发者 https://www.devze.com 2023-01-08 08:40 出处:网络
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 programmati

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号