• iOS 。开发之指纹识别功能


    // 头文件导入 
    
    #import <LocalAuthentication/LocalAuthentication.h>
     //在iPhone5s的时候,苹果推出了指纹解锁。但是在ios8.0的时候苹果才推出相关的接口。所以,
        /**
         *  第一步,验证版本
         */
        if ([UIDevice currentDevice].systemVersion.floatValue < 8.0) {
            return nil;
        }
        /**
         *  第二步,创建LAContext
         */
        LAContext *ctx = [[LAContext alloc] init];
        NSError *error;
        //判断设备是否支持指纹识别
        if ([ctx canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
            NSLog(@"请按手指");
            //输入指纹
            [ctx evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"提示文字" reply:^(BOOL success, NSError * _Nullable error) {
                if (success) {
                    NSLog(@"验证成功");
                }else{
                    
                    if (error.code == LAErrorUserFallback) {
                        NSLog(@"User tapped Enter Password");
                    } else if (error.code == LAErrorUserCancel) {
                        NSLog(@"User tapped Cancel");//用户点了取消
                    } else {
                        NSLog(@"Authenticated failed.");//验证失败
                    }
                }
            }];
         
        }else{
             NSLog(@"请用密码验证");
        }
        
  • 相关阅读:
    面向对象的相关知识
    模块的导入
    正怎表达式在爬虫里的应用
    前端~css
    CSS知识点
    初识Html
    Python之路--协程/IO多路复用
    进程
    锁 和 线程池
    操作系统-并发-线程-进程
  • 原文地址:https://www.cnblogs.com/shenlaiyaoshi/p/9464974.html
Copyright © 2020-2023  润新知