zoukankan      html  css  js  c++  java
  • IOS 指纹校验功能

    指纹校验 就两步:

    1.验证设备是否支持指纹功能

    #pragma mark - 校验设备指纹解锁功能是否可用
    - (BOOL)canEvaluatePolicy
    {
        LAContext *context = [[LAContext alloc] init];
        NSError *error;
        return [context canEvaluatePolicy: LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error];
    }

    2.提示手指放在home键上开始校验指纹

    #pragma mark - 校验指纹
    - (void)evaluatePolicy
    {
        LAContext *context = [[LAContext alloc] init];
        // show the authentication UI with our reason string
        [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"手指放在home键上校验指纹" reply:^(BOOL success, NSError *authenticationError){
            SuccessViewController *isSuccess = [self.storyboard instantiateViewControllerWithIdentifier:@"SuccessViewController"];
            if (success)
            {
                isSuccess.labText = @"校验成功!";
            }
            else
            {
                isSuccess.labText = [NSString stringWithFormat:@"校验失败!
    %@",authenticationError.localizedDescription];
            }
            [self presentViewController:isSuccess animated:YES completion:nil];
        }];
    }

    调用方式:

    - (IBAction)startCheckOut:(UIButton *)sender
    {
      //如果设备支持指纹功能
    if ([self canEvaluatePolicy]) {
         //校验指纹 [self evaluatePolicy]; } }
  • 相关阅读:
    day23,xml 和面向对象
    day22,ConfigParser,subprocess,xlrd三个模块
    re的总结
    day20,日志和正则表达式
    day19,序列化与反序列化总结,和其它的有些模块
    字符串的内建函数
    字符串和编码
    python解释器分类
    git &github 快速入门
    do export method of oracle all database tables with dmp files.
  • 原文地址:https://www.cnblogs.com/Mgs1991/p/5331993.html
Copyright © 2011-2022 走看看