在iPhone5s之后,蘋果加入了指紋識別功能,接下來就看看如何接入我們自己的工程!
1.首先要引入頭文件#import <LocalAuthentication/LocalAuthentication.h>
2.初始化
LAContext *lacontext = [[LAContext alloc]init];
3.判斷設(shè)備是否支持指紋識別
if(![lacontext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:NULL])
{
NSLog(@"不支持!");
return;
}
4.驗證指紋識別
[lacontext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"請按Home鍵識別指紋" reply:^(BOOL success, NSError *error)
{
if(success)
{
NSLog(@"成功后,處理事件");
}
}];
其他需求可以閱讀開發(fā)文檔!