iOS 第三方读取指纹
来源:互联网 发布:怎么修改电脑的端口 编辑:程序博客网 时间:2024/05/19 20:00
第三方读取指纹必须是在ios8以上
首先导入TouchId的必须库 #import <LocalAuthentication/LocalAuthentication.h>
这个库必须要Xcode6并且连接的是真机,才不会提示找不到的错误,即使不是iPhone5s都行. 如果是模拟器会提示找不到这个库
然后在某个触发的事件内写上如下代码
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"" delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil, nil]; LAContext *myContext = [[LAContext alloc] init]; NSError *authError = nil; NSString *myLocalizedReasonString = @"Restricted Area!"; if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) { [myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:myLocalizedReasonString reply:^(BOOL success, NSError *error) { if (success) { // User authenticated successfully, take appropriate action alert.title = @"Success"; alert.message = @"You have access to private content!"; [alert show]; } else { // User did not authenticate successfully, look at error and take appropriate action alert.title = @"Fail"; switch (error.code) { case LAErrorUserCancel: alert.message = @"Authentication Cancelled"; break; case LAErrorAuthenticationFailed: alert.message = @"Authentication Failed"; break; case LAErrorPasscodeNotSet: alert.message = @"Passcode is not set"; break; case LAErrorSystemCancel: alert.message = @"System cancelled authentication"; break; case LAErrorUserFallback: alert.message = @"You chosed to try password"; break; default: alert.message = @"You cannot access to private content!"; break; } [alert show]; } }]; } else { // Could not evaluate policy; look at authError and present an appropriate message to user alert.title = @"Warning"; if(authError.code == LAErrorTouchIDNotEnrolled) { alert.message = @"You do not have any fingerprints enrolled!"; }else if(authError.code == LAErrorTouchIDNotAvailable) { alert.message = @"Your device does not support TouchID authentication!"; }else if(authError.code == LAErrorPasscodeNotSet){ alert.message = @"Your passcode has not been set"; } [alert show]; }
0 0
- iOS 第三方读取指纹
- IOS第三方库
- IOS第三方资源库
- iOS第三方库
- IOS第三方资源库
- IOS 第三方库
- iOS第三方框架
- ios 第三方库
- iOS 第三方库
- iOS第三方MagicalRecord
- iOS 第三方库
- IOS 第三方库
- iOS 第三方分享
- ios 第三方支付
- IOS第三方库
- iOS第三方
- IOS第三方支付
- iOS 常用第三方
- C++面试题目
- 学习分享
- 将data转换成字符串,没有类方法
- 网络中关于IP的介绍
- 安装和配置nginx
- iOS 第三方读取指纹
- 1 面试杂谈
- Python IDE:PyCharm中的那些实用功能
- 透过付费通12周年揭秘生活细节中数字背后的内涵
- 【iOS开发-多线程】使用NSThread创建多线程
- rgba ie8及以下的降级方案
- MFC子对话框建立与关闭
- 03.Longest Substring Without Repeating Characters
- Windows下 maven3.0.4的安装步骤+maven配置本地仓库