Ash*_*ish 19 iphone ios ios-simulator touch-id ios8
我正在开发一个需要Touch ID身份验证的应用程序,所以有什么方法可以在模拟器中使用Touch ID(指纹扫描仪)吗?
另外,请分享使用LocalAuthentication框架的某种示例代码.
kar*_*hik 61
XCODE 7 beta支持在iPhone模拟器中测试Touch ID身份验证.您可以尝试将其用于测试.
[截图1]
![[截图1]](https://i.stack.imgur.com/ml3L9.png)
[截图2]
![[截图2]](https://i.stack.imgur.com/o0XLN.png)
Woo*_*ock 10
截至最新测试版(6),无法在模拟器上模拟指纹扫描.说实话,我怀疑即使在以后的测试版中也会包含这些内容.
您需要在设备上进行测试.
要立即使用身份验证框架,您需要:*带有iOS 8的XCode 6*iPhone 5s
您需要执行的步骤是:
了解设备是否支持指纹验证以及是否注册了指纹:
@import LocalAuthentication;
// Get the local authentication context:
LAContext *context = [[LAContext alloc] init];
// Test if fingerprint authentication is available on the device and a fingerprint has been enrolled.
if ([context canEvaluatePolicy: LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil])
{
NSLog(@"Fingerprint authentication available.");
}
Run Code Online (Sandbox Code Playgroud)
仅验证指纹:
[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"Authenticate for server login" reply:^(BOOL success, NSError *authenticationError){
if (success) {
NSLog(@"Fingerprint validated.");
}
else {
NSLog(@"Fingerprint validation failed: %@.", authenticationError.localizedDescription);
}
}];
Run Code Online (Sandbox Code Playgroud)
根据用户的选择验证指纹或设备的密码: 这有点超出了问题的范围,请在以下网址找到更多信息:https://www.secsign.com/fingerprint-validation-as-an-alternative -to-通行码/
| 归档时间: |
|
| 查看次数: |
25116 次 |
| 最近记录: |