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");
        }
        
        
        
        
        
        
    }

  • 相关阅读:
    angularjs 判断是否包含 permIDs|filter:'10'
    js日期格式化
    JSON格式检验
    CodeSmith Generator 6.5
    Hosts文件说明
    正则表达式匹配换行实例代码
    Codeforces 311E Biologist
    URAL 1349 Farm
    [SDOI2015] 序列统计
    洛谷 P3803 多项式乘法
  • 原文地址:https://www.cnblogs.com/thbbsky/p/4556103.html
Copyright © 2011-2022 走看看