zoukankan      html  css  js  c++  java
  • 关于iOS 3D touch 指纹验证的随笔

    file:///Users/OWen/Desktop/3DTouch.png

    随着iOS系统不断的更新迭代,苹果总会推出一些新的功能,今天就研究了一下iOS8之后推出的指纹验证的功能,然后写了一个小demo,与君分享。。

    上demo:   1:首先导入一个系统的库文件      #import <LocalAuthentication/LocalAuthentication.h>

                     2:

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

        

        NSString *myLocalizedReasonString = @"小伙子,请输入你的指纹";

        NSError *authError = nil;

        if ([mycontent canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {

            

            [mycontent evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics

             

                      localizedReason:myLocalizedReasonString

             

                                reply:^(BOOL success, NSError *error) {

                                    

                                    if (success) {

                                        

                                        // User authenticated successfully, take appropriate action

                                        

                                    } else {

                                        

                                        NSLog(@"-----%@",error);

                                        

                                        // User did not authenticate successfully, look at error and take appropriate action

                                    }

                                }];

            

        } else {

            // Could not evaluate policy; look at authError and present an appropriate message to user

        }

     注意,测试神马的还得在真机上调试。

  • 相关阅读:
    在家工作,10招助你效率、生活两不误
    SQL Server智能感知如何更新
    博客园文章《我记录,故我在》读后感
    Python 协程
    Python 用多线程上传和下载文件
    Python 变量交换
    Python 将文件重新命名
    Python ftplib模块
    Python ftplib模块
    Python 函数作为返回值
  • 原文地址:https://www.cnblogs.com/110-913-1025/p/5566353.html
Copyright © 2011-2022 走看看