zoukankan      html  css  js  c++  java
  • ios 指纹识别解锁

    1:添加LocalAuthentication.framework框架
    2:实现过程
    #import "ViewController.h"
    #import <LocalAuthentication/LAContext.h>
    @interface ViewController ()
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
      
        LAContext *myContext = [[LAContext alloc]init];
        myContext.localizedFallbackTitle = @"忘记密码";
        
        NSError *error = nil;
        NSString *myLocalizedReasonString = @"请输入指纹";
        if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
           
            [myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
           
                      localizedReason:myLocalizedReasonString
            
                                reply:^(BOOL success, NSError *error) {
                                   
                                    if (success) {
                                       
                                        NSLog(@"success");
                                       
                                    } else {
                                       
                                        // User did not authenticate successfully, look at error and take appropriate action
                                     NSLog(@"did not authenticate successfully");
                                      
                                    }
                                  
                                }];
           
        } else {
          
            // Could not evaluate policy; look at authError and present an appropriate message to user
           NSLog(@"Could not evaluate policy");
        }
        
        
        
        
        
        
    }

  • 相关阅读:
    技术一定要动手做一遍才算自已的
    终于提离职了,感觉如释重负
    自我评定与学习计划
    MYSQL---INSERT...SELECT...
    MYSQL---LIMIT
    SQL---having
    MYSQL---数据定义
    CSS---Block和inline元素对比
    CSS---清除浮动
    T-SQL---分页语句
  • 原文地址:https://www.cnblogs.com/thbbsky/p/4556103.html
Copyright © 2011-2022 走看看