iOS指纹识别的简单应用

2022-10-21,

这篇文章主要为大家详细介绍了iOS指纹识别的简单应用,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

指纹识别(Touch ID)的简单应用,供大家参考,具体内容如下

1、调用

- (void)viewDidLoad {
 [super viewDidLoad];
 // Do any additional setup after loading the view, typically from a nib.
 
 
 [self setupNotification];
 UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
 [button setTitle:@"点击调用" forState:UIControlStateNormal];
 [button addTarget:self action:@selector(actionDidClickButton:) forControlEvents:UIControlEventTouchUpInside];
 [button setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
 [self.view addSubview:button];
}

- (void)actionDidClickButton:(UIButton *)sender
{
 [self touchIDTest];
}
- (void)touchIDTest
{
 [TouchIDManager validateTouchID];
}

- (void)setupNotification
{
 [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(actionDidReceiveValidateTouchIDSuccess) name:ValidateTouchIDSuccess object:nil];
 [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(actionDidReceiveValidateTouchIDNotAvailable) name:ValidateTouchIDNotAvailable object:nil];
 [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(actionDidReceiveValidateTouchIDNotEnrolled) name:ValidateTouchIDNotEnrolled object:nil];
 [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(actionDidReceiveValidateTouchIDAuthenticationFailed) name:ValidateTouchIDAuthenticationFailed object:nil];
 [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(actionDidReceiveValidateTouchIDCancel) name:ValidateTouchIDCancel object:nil];
 [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(actionTouchIDLockout) name:ValidateTouchIDLockout object:nil];
}
- (void)actionDidReceiveValidateTouchIDSuccess
{
 NSLog(@"%s",__func__);
}
- (void)actionDidReceiveValidateTouchIDNotAvailable
{
 NSLog(@"%s",__func__);
}
- (void)actionDidReceiveValidateTouchIDNotEnrolled
{
 NSLog(@"%s",__func__);
}
- (void)actionDidReceiveValidateTouchIDAuthenticationFailed
{
 NSLog(@"%s",__func__);
}
- (void)actionDidReceiveValidateTouchIDCancel
{
 NSLog(@"%s",__func__);
}
- (void)actionTouchIDLockout
{
 NSLog(@"%s",__func__);
}
- (void)dealloc
{
 [[NSNotificationCenter defaultCenter]removeObserver:self];
}

具体demo

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持北冥有鱼。

您可能感兴趣的文章:

  • vue单应用在ios系统中实现微信分享功能操作
  • iOS如何开发简单的手绘应用实例详解
  • iOS应用脚本重签名的实现方法
  • 详解IOS微信上Vue单页面应用JSSDK签名失败解决方案
  • 利用Angular2 + Ionic3开发IOS应用实例教程
  • iOS实现应用内切换语言及字体大小(模仿微信)
  • iOS应用内实现跳转到手机淘宝天猫的方法
  • IOS应用内支付返回新旧Receipt适配的方法
  • iOS如何优雅地消除应用角标详解
  • 如何在 iOS 应用中添加位置信息

《iOS指纹识别的简单应用.doc》

下载本文的Word格式文档,以方便收藏与打印。