指纹识别
2016-04-25 22:38
302 查看
#import "ViewController.h"
#import <LocalAuthentication/LocalAuthentication.h>
@interface
ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super
viewDidLoad];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
LAContext *contex = [[LAContext
alloc]init];
BOOL isCan = [contex
canEvaluatePolicy:LAPolicyDeviceOwnerAuthentication
error:nil];
//因为有的设备
没有指纹识别
if (isCan) {
[contex evaluatePolicy:LAPolicyDeviceOwnerAuthentication
localizedReason:@"识别验证打开支付宝!"
reply:^(BOOL success,
NSError *
_Nullable error) {
if (success) {
NSLog(@"识别成功!!!!");
}else{
if (error.code ==
kLAErrorUserFallback) {
NSLog(@"用户点击了输入密码!");
}
if (error.code ==
kLAErrorUserCancel) {
NSLog(@"用户点击了取消!");
}
}
}];
}else{
NSLog(@"不支持");
}
}
@end
#import <LocalAuthentication/LocalAuthentication.h>
@interface
ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super
viewDidLoad];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
LAContext *contex = [[LAContext
alloc]init];
BOOL isCan = [contex
canEvaluatePolicy:LAPolicyDeviceOwnerAuthentication
error:nil];
//因为有的设备
没有指纹识别
if (isCan) {
[contex evaluatePolicy:LAPolicyDeviceOwnerAuthentication
localizedReason:@"识别验证打开支付宝!"
reply:^(BOOL success,
NSError *
_Nullable error) {
if (success) {
NSLog(@"识别成功!!!!");
}else{
if (error.code ==
kLAErrorUserFallback) {
NSLog(@"用户点击了输入密码!");
}
if (error.code ==
kLAErrorUserCancel) {
NSLog(@"用户点击了取消!");
}
}
}];
}else{
NSLog(@"不支持");
}
}
@end
相关文章推荐
- 【Grades Crawler】利用python编写爬虫 爬取西电教务处成绩并本地保存
- c++第四次实验(穷举法解决组合问题,问题3)
- Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) D. Little Artem and Dance 模拟
- 个人报告07
- JSON.parse() 和 JSON.stringify()使用
- samba
- CentOS7 下安装jdk
- SDOI2016 R1 day2 T3 征途 斜率优化DP
- C#操作XML-创建-追加-带属性的读写(全)
- usaco隐藏口令
- [android] 看博客学习Android常见的几种RuntimeException
- 苹果安装tomcat方法
- nagios常见错误
- malloc和new的区别
- ffmpeg的编译
- ListView中convertView和ViewHolder的工作原理
- <github for windows(win10)客户端安装教程>
- 《Linux内核设计与实现》读书笔记 4 进程调度
- Public key for apr-util-1.2.7-11.el5_5.1.i386.rpm is not installed
- 7、DOM解析