ios-指纹识别
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
//1. 判断系统版本
if ([UIDevice currentDevice].systemVersion.floatValue >= 8.0) {
//可以使用指纹识别 --> 5S 以后的机型
LAContext *context = [[LAContext alloc] init];
if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil]) {
// 可以使用
//3. 开始启用指纹识别
//localizedReason : 显示在界面上的原因, 一般用于提示用户, 为什么要使用此功能
[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"请验证指纹, 以打开高级隐藏功能" reply:^(BOOL success, NSError * _Nullable error) {
//判断是否成功
if (success) {
//4. 指纹识别在更新 UI 时, 一定要注意, 在主线程更新
dispatch_sync(dispatch_get_main_queue(), ^{
[self createUIAlertController:@"验证成功"];
});
} else {
dispatch_sync(dispatch_get_main_queue(), ^{
[self createUIAlertController:@"验证失败"];
});
}
// 判断错误 如果需要区分不同的错误来提示用于, 必须判断 error
if (error) {
NSLog(@"error Code: %ld",error.code);
NSLog(@"error : %@",error.userInfo);
}
}];
} else {
NSLog(@"对不起, 5S 以上机型才能使用此功能");
}
} else {
NSLog(@"对不起, 系统版本过低");
}
}
-(void)createUIAlertController:(NSString*)title
{
UIAlertController * alert =[UIAlertController alertControllerWithTitle:@"提示" message:title preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction * action =[UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
}];
UIAlertAction * action1 =[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
}];
[alert addAction:action1];
[alert addAction:action];
[self presentViewController:alert animated:YES completion:nil];
}


ios-指纹识别的更多相关文章
- iOS指纹识别Touch ID的安全性探讨
苹果公司在 iPhone 5s 的发布会上公布了全新的指纹识别安全技术,也就是 Touch ID,开创了生物安全识别技术在便携设备上使用的新篇章.此后,苹果还将此技术带到了 iPad 上.此前没有任何 ...
- IOS指纹识别调用
最近正在开发的一个app需要加入指纹识别的功能,先搜索一下找到官方文档,简单易懂: https://developer.apple.com/library/ios/documentation/Loca ...
- iOS指纹识别
#import "ViewController.h" #import <LocalAuthentication/LocalAuthentication.h> @inte ...
- IOS 指纹识别的简单使用
首先导入LocalAuthentication框架 然后导入头文件 #import <LocalAuthentication/LAPublicDefines.h> - (void)begi ...
- iOS指纹识别代码
1:添加LocalAuthentication.framework框架 2:实现过程 #import "ViewController.h" #import <LocalAut ...
- ios 指纹识别解锁
:添加LocalAuthentication.framework框架 :实现过程 #import "ViewController.h" #import <LocalAuthe ...
- iOS - TouchID 指纹识别
前言 NS_CLASS_AVAILABLE(10_10, 8_0) @interface LAContext : NSObject 指纹识别功能是 iPhone 5s 推出的,SDK 是 iOS 8. ...
- ios开发-指纹识别
最近我们使用支付宝怎么软件的时候,发现可以使用指纹了,看起来是否的高大上.当时苹果推出了相关接口,让程序写起来很简单哈. 在iPhone5s的时候,苹果推出了指纹解锁.但是在ios8.0的时候苹果才推 ...
- 指纹识别人脸识别 iOS
//1.判断iOS8及以后的版本 if([UIDevice currentDevice].systemVersion.doubleValue >= 8.0){ //从iPhone5S开始,出现指 ...
- iOS 钥匙串 指纹识别 get和Post请求的区别
01-钥匙串 1. 通过系统提供的钥匙串功能可以在本地保存密码,系统使用AES的方式对密码加密 a. 查看Safari中保存的密码 2. 使用第三方框架SSKeychain把密码保存到钥匙串和获取钥匙 ...
随机推荐
- linux下跳板机跟客户端之间无密码登陆
创建证书: [root@lnmp src]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which ...
- NVelocity模板引擎的使用
第一种使用方法直接赋值: VelocityEngine vltEngine = new VelocityEngine(); vltEngine.SetProperty(RuntimeConstants ...
- ytu 1980:小鼠迷宫问题(DFS 深度优先搜索)
小鼠迷宫问题 Time Limit: 2 Sec Memory Limit: 64 MB Submit: 1 Solved: 1 [Submit][Status][Web Board] Desc ...
- [原]DbHelper-SQL数据库访问助手
using System; using System.Data; using System.Data.SqlClient; namespace Whir.Software.Framework.Ulti ...
- oracle中merge的详解
Oracle在9i引入了merge命令, 通过这个merge你能够在一个SQL语句中对一个表同时执行inserts和updates操作. 当然是update还是insert是依据于你的指定的条件判断的 ...
- WITH AS短语,也叫做子查询部分(subquery factoring)
可以让你做很多事情,定义一个SQL片断,该SQL片断会被整个SQL语句所用到. 作为提供数据的部分. 代码例子: with temp as (select ID, Type_Name, Type_ID ...
- Android 生成和Pull解析xml
一.单个对象生成xml 生成以下xml,该怎么生成呢? <?xml version='1.0' encoding='UTF-8' standalone='yes' ?> <accou ...
- 异步加载图片Universal-Image-Loader
项目地址:https://github.com/nostra13/Android-Universal-Image-Loader
- org.apache.flume.FlumeException: NettyAvroRpcClient { host: xxx.xxx.xxx.xxx, port: 41100 }: RPC
2014-12-19 01:05:42,141 (lifecycleSupervisor-1-1) [WARN - org.apache.flume.sink.AbstractRpcSink.star ...
- 亲和数[HDU2040]
亲和数 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submiss ...