iOS指纹识别代码
2024-08-30 14:47:38
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");
}
}
最新文章
- php 常见的问题
- Java中的Comparable<;T>;和Comparator<;T>;接口
- jsonp获取服务器数据的方式
- bjfu1109 最小公倍数和
- poj 3007 Organize Your Train part II(静态字典树哈希)
- dojo.io.script
- SystemParametersInfo API学习(128个中文参数解释,215个实际值)
- 进一步解 apt-get 的几个命令
- 聊聊Java中几种常用的设计模式
- Multi-Projector Based Display Code ---- ImageViewer
- 基于jmeter的性能测试平台(一)分布式jmeter搭建
- Android basics
- 关于windows下的虚拟机Homestead在推送代码上github 步骤
- zabbix server配置文件参数详解
- python 函数调用顺序
- SEO-搜索引擎优化
- Dom操作(标签--增、删、移动)
- vue轮播图
- npm常见配置收集
- EntityFramework 学习 一 Validate Entity