有没有一种方法可以在应用程序运行时“强制”用户自动锁定(并可能设定密码锁),以提高安全性?如果我们无法程序化设置它们,那么我们至少可以检查它们是否被设置吗?
谢谢, Mihai
if ([UIApplication sharedApplication].idleTimerDisabled == YES) {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Please enable auto-lock"...];
[alert show];
[alert release];
} else {
/* some code */
}
idleTimerDisabled
与用户设置自动锁定无关。您将永远得到这个结果:(lldb) p (int)[[UIApplication sharedApplication] isIdleTimerDisabled] (int) $0 = 0
- Philip007
[[UIApplication sharedApplication] setIdleTimerDisabled: NO];
或者[[UIApplication sharedApplication] setIdleTimerDisabled: YES];
但是,就像我之前所说的,我还没有测试过这是否会覆盖用户在“设置”应用中设置的选项。 - iwasrobbed