IOS开发-指纹识别
来源:互联网 发布:windows caffe mnist 编辑:程序博客网 时间:2024/05/18 02:09
苹果系统自带指纹识别功能,只需要调用方法就可以实现指纹识别的功能。
代码:
<span style="font-size:14px;"> if ([UIDevice currentDevice].systemVersion.floatValue < 8.0) { NSLog(@"不支持"); return; } LAContext *ctx = [[LAContext alloc] init]; // 判断设备是否支持指纹识别 if ([ctx canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:NULL]) { NSLog(@"支持"); // 异步 // 提示:指纹识别只是判断当前用户是否是手机的主人。 [ctx evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"指纹登录" reply:^(BOOL success, NSError *error) { if (success) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"指纹认证成功" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil]; [alert show]; }else if(error){ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"指纹认证失败" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil]; [alert show]; } }]; } else { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"没有开启TOUCHID设备" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil]; [alert show]; }</span>
只需要在方法中加入上面的代码,就可以直接调用,实现指纹认证
#import "LocalAuthentication/LAContext.h"
头文件导入不能忘了
0 0
- IOS开发-指纹识别
- ios开发之指纹识别
- IOS开发-指纹识别
- iOS开发--touchID指纹识别
- iOS开发之指纹识别
- iOS开发之指纹识别
- iOS开发 指纹识别
- iOS开发--iOS 指纹识别常见问题汇总
- iOS开发--iOS 指纹识别常见问题汇总
- iOS 开发 指纹识别解锁详解
- iOS开发——Touch ID 指纹识别
- iOS开发 实现指纹识别及验证
- iOS指纹识别
- iOS指纹识别
- ios指纹识别
- iOS 指纹识别
- iOS 指纹识别
- iOS指纹识别
- iOS学习笔记7- iOS 添加定制字体到应用程序中
- windows安卓NDK编程
- 素数打表法
- flume kafka-sink high cpu
- yii打印sql语句
- IOS开发-指纹识别
- Java类型转换实例
- Attribute Unavailable: First baseline layout attribute on iOS versions prior to 8.0
- 文章标题
- C++的静态成员函数指针
- 南邮 OJ 1100 最长回文子串
- 触摸事件分发机制总结
- The hierarchy of the type MethodBeforeAdvice is inconsistent
- [网络流24题] 05 圆桌聚餐(最大流判满流)