gpt4 book ai didi

ios - 没有iPhone 5s设备时如何测试Touch ID功能

转载 作者:行者123 更新时间:2023-12-01 18:53:36 25 4
gpt4 key购买 nike

我想在应用程序中实现触摸ID功能,为此我编写了代码:

LAContext *context = [[LAContext alloc] init];

NSError *error = nil;
if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:@"Are you the device owner?"
reply:^(BOOL success, NSError *error) {

if (error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"There was a problem verifying your identity."
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
return;
}

if (success) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Success"
message:@"You are the device owner!"
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];

} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"You are not the device owner."
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}

}];

} else {

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Your device cannot authenticate using TouchID."
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];

}

我没有支持触摸ID功能的设备,因此在哪里可以对其进行测试以查看其功能是否正常。

任何帮助,将不胜感激。谢谢。

最佳答案

您只能在真实设备上测试TouchID。模拟器不支持此功能。

关于ios - 没有iPhone 5s设备时如何测试Touch ID功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29388962/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com