Targetting iOS 8 with Monotouch
When our app starts up on iOS I would like to check that the user has set a Passcode (at least) and a screen timeout of no more than 3 minutes.
If they have not I want to Force them to go to Settings and do so. Is this possible?
It is possible for Android apps with Admin permissions
Try this out :)
https://github.com/liamnichols/UIDevice-PasscodeStatus
Once you've added the category you can check it like so:
- (void)checkPasscodeState
{
LNPasscodeStatus status = [UIDevice currentDevice].passcodeStatus;
switch (status) {
case LNPasscodeStatusEnabled:
// a passcode is set
break;
case LNPasscodeStatusDisabled:
// passcode is not set
break;
case LNPasscodeStatusUnknown:
default:
// error checking.. fallback somehow.
break;
}
}
Alternatively, if this is for an enterprise app and you have an MDM system, you could use a configuration profile to require that a passcode is set on the device.
To verify that the user has a passcode, you can attempt storing an item in the Keychain with kSecAttrAccessible
set to kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly
. Then you can verify that it exists and indirectly verify that the user has a passcode.
不,您目前无法获得有关密码和屏幕自动锁定延迟时间的信息。
We can achieve this only by MDM in ios device where we can directly enforce this. For Android as you said this could be achieved in may ways
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.