您的位置:首页 > 其它

指纹识别

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: