iOS开发--指纹解锁

iOS指纹验证功能详解与实战:MTTouchIdDemo项目解析 本文还有配套的精品资源,点击获取 简介:本文深入探讨了iOS开发中常见且安全的指纹验证功能,特别是在用户登录和支付确认等场景中的应用。通过分析作者yimouleng创建的MTTouchIdDemo项目,文章讲解了如何简化集成Touch ID验证的过程。Touch ID是苹果的生物识别技术,通过指纹识别提高用户体验和安全性。项目包含核心类MTTouchID和ViewContr... 阅读详情

前言

指纹解锁是自苹果公司推出iPhone 5s后推出的,将加密做到官方化,为APP的保密性提供了高度的方便性.

正文

指纹解锁很简单,三步即可搞定

第一步 请求

请求当前设备是不是支持指纹解锁

LAContext *context = [LAContext new];
NSError *error = NULL;
__weak typeof(self) WS = self;
if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
    // 进行第二步骤
} else {
    if (resultBlock) {
        resultBlock(NO, @"不支持指纹");
    }
}

第二步 验证

这里需要知道的是,
iOS 9之前,指纹解锁只支持纯指纹解锁,
iOS 9之后,指纹解锁支持纯指纹解锁和指纹密码混合解锁两种方式

LAPolicy policy = LAPolicyDeviceOwnerAuthenticationWithBiometrics;

if (@available(iOS 9.0, *)) {
    switch (fingerprintType) {
        case FingerprintTool_OnlyFinger:
            policy = LAPolicyDeviceOwnerAuthenticationWithBiometrics;
            break;
        case FingerprintTool_FingerAndPassword:
            policy = LAPolicyDeviceOwnerAuthentication;
            break;
    }
} else {
    NSLog(@"指纹和密码的解锁模式,只支持系统版本大于或者等于9.0");
}

[context evaluatePolicy:policy
        localizedReason:localizedReason
                  reply:^(BOOL success, NSError * _Nullable error) {
                              // 第三步骤
                  }];

第三步 结果处理

结果处理,主要是处理成功和失败的情况,失败需要处理失败的原因(在你需要的话),失败基本上分为客观原因和人为原因(这里指的是人为取消)

if (resultBlock) {
    NSString *resultString = [WS referenceError:error 
                                 fallbackString:fallbackString];
    resultBlock(success, resultString);  
}
#pragma mark 返回错误参考信息
+ (NSString *)referenceError:(NSError *)error fallbackString:(NSString *)fallbackString {
    switch (error.code) {
        case LAErrorAuthenticationFailed:
            return @"授权失败";
            break;
        case LAErrorUserCancel:
            return @"用户取消验证Touch ID";
            break;
        case LAErrorUserFallback:
            return fallbackString;
            break;
        case LAErrorSystemCancel:
            return @"系统取消授权,如其他APP切入";
            break;
        case LAErrorPasscodeNotSet:
            return @"系统未设置密码";
            break;
        case LAErrorTouchIDNotAvailable:
            return @"设备Touch ID不可用,例如未打开";
            break;
        case LAErrorTouchIDNotEnrolled:
            return @"设备Touch ID不可用,用户未录入";
            break;
        case LAErrorTouchIDLockout:
            return @"身份验证未成功,多次使用Touch ID失败";
            break;
        case LAErrorAppCancel:
            return @"认证被取消的应用";
            break;
        case LAErrorInvalidContext:
            return @"授权对象失效";
            break;
        case LAErrorNotInteractive:
            return @"APP未完全启动,调用失败";
            break;

        default:
            return @"验证成功";
            break;
    }
}

结语

最后附上demo,如果感觉对你有所帮助,小星星走起⭐️⭐️⭐️

金融核心系统云架构改造:从IOE到云原生的落地路径与避坑指南 金融核心系统正经历从IOE集中式架构向云原生分布式架构的演进,以应对高并发、高可用和高一致性的业务诉求。容器化、微服务、Kubernetes等云原生技术提供了弹性伸缩与故障自愈能力,但数据分片、分布式事务和全链路监控等新挑战也随之而来。金融核心系统上云并非单纯更换基础设施,而是涉及应用拆分、数据一致性设计、同城双活容灾以及生产环境运维的全局重构。围绕这一转型过程,梳理了从存量系统改造到新核心构建的落地路径,剖析了账务一致性、连接池治理、容灾演练等关键实践,并总结了常见避坑指南,为金融行业的架构师与运维团队提 阅读详情

相关推荐

IAP板卡远程升级(串口网口都可)+Ymodem+AES对bin文件加密+pc软件+板卡相互烧录

还是决定记录一下,毕竟这个东西我也搞了挺久的,遇到一些棘手的,或者是因为我很粗心遇到的问题也和大家分享一下,。 板卡核心是 STM32F103RCT6,256kflash 前言 开始看这个远程升级的时候,我是一头雾水的,原子哥的教程里面也有说到过iap,有了一个大概的了解,我想不明白的是,通过串口下载的方式把hex文件下载到flash,和把bin文件下载到flash难道不是拉一根线,下载一个文件嘛,(初入职场的我并没有考虑到安全这个问题)如果直接将hex文件给到客户那边,风险是非常大...

那可真是太开心了的博客 5371

iOS 实现指纹识别

在 iOS 应用中实现指纹识别(Touch ID)或面部识别(Face ID)功能,可以使用 Apple 提供的框架。

zhangjikuan89的博客 760

complier lab2

只需支持定义 main 函数即可不带参数 int main(){...}带参数 int main(int argc, int argv){...}

qq_43581843的博客 904

iOS指纹登录面容登录功能开发详解

文章主要介绍了iOS指纹登录和面容登录功能的实现流程和原理。首先,文章指出由于产品和运营对用户隐私的担忧,该功能一直未接入。实际上,App仅使用系统录入的信息进行验证,不会采集用户指纹或面容信息。接着,文章详细描述了登录流程,包括用户登录完成后提示绑定指纹/面容登录、判断设备支持情况、绑定ID的生成和规则等。在用户交互方面,文章建议在绑定和登录时提示用户平台只接收验证结果,不采集用户信息,并在个人中心设置页增加关闭入口。最后,文章提供了代码实现,包括封装成工具类方便调用、检查生物识别状态、绑定设备、登录页的

devil_0311的博客 1080

LIN 协议测试

如下图,使用PicoScope示波器抓取报文Id为0x18的波形,数据场Byte1的长度为519.994μs,Byte1共10bit,计算位时间:tBit= 519.994/10 = 51.9994μs,符合预期。■ 唤醒信号是一个250μs到5ms的显性电平,发送唤醒信号的节点发送唤醒信号后150ms~250ms没有收到其他节点的唤醒信号,发送唤醒信号的节点发送新的唤醒信号。对于LIN主节点,检查发送的帧头长度是否符合设计要求,对于LIN从节点,检查从节点能否正确响应设计范围之内的帧头长度。

m0_63902994的博客 5929

避坑指南:Win11修改用户文件夹名称后,如何彻底解决残留文件与路径错误?

本文针对Win11用户修改用户文件夹名称后遇到的残留文件与路径错误问题,提供了一套完整的解决方案。从诊断进程占用、使用资源监视器与命令行强力清理,到修复系统环境变量与软件配置,并详细介绍了创建符号链接这一终极兼容方案,帮助用户彻底解决路径依赖问题,恢复系统稳定。

pz890123的博客 831

iOS开发 指纹识别

在网上找到的一些iOS开发 指纹识别资料,分享给大家。 首先引入类名: #import 1 然后在实现指纹识别的地方放入如下代码:  方式一: LAContext *lacontext = [[LAContext alloc]init]; // 判断设备是否支持指纹识别 BOOL isSupport = [lacontext canEvaluatePolicy:L

风雪寒晨的博客 721

软考备考:《系统规划与管理师教程》(第2版)第2章——数字ZG与数智化发展

🔴数字化转型的定义:数字化转型是建立在数字化转换、数字化升级基础上,进一步触及组织核心业务,以新建一种业务模式为目标的高层次转型。

✨ 欢迎来到【Seal ^_^ 的优快云博客】!✨ 960

iOS指纹解锁和手势解锁

iOS指纹解锁和手势解锁

Innocence_0的博客 566

SAP Event Mesh 简介

Get Started with Messaging for Decoupled Communication Step 1: What is the SAP Event Mesh service? SAP Event Mesh 是一种完全托管的服务,用于连接应用程序、服务和系统,以便它们可以通过消息和事件相互交互。 它通过引入中央消息代理取代了传统的点对点通信。 虽然点对点通信适用于在有限数量的发送方和接收方之间共享数据,但可扩展性很快就会成为一个问题。 SAP Event Mesh 解决了这个问题,并确保

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 1241

【即插即用模块】Transformer篇 | ICCV 2025 | MALA :注意力分布神似Softmax,告别线性注意力性能短板!

MALA(Magnitude-Aware Linear Attention)是一种改进的线性注意力机制,通过引入缩放因子和偏移项,解决了传统线性注意力忽视查询幅度的问题,使其分布更接近Softmax Attention。该模块具有线性复杂度(O(n)),结合RoPE和LEPE编码实现全局-局部位置信息混合,通过z值调制平衡信息权重。实验表明MALA在轻量级视觉任务中能有效平衡效率与精度,注意力可视化显示其分布与Softmax Attention高度相似。代码提供完整的RoPE位置编码和线性注意力

主要更新底层视觉(去噪、超分等)相关的科研内容,形式为【论文精读】+【论文复现】 1106

iOS开发之指纹解锁

前一阵子一直在赶项目进度,没有太多时间写博客,现在终于空闲了,将以前欠下的博客补上来。 在iOS8.0之后,API开放了指纹验证的功能。开放的API虽然只能用来作为验证使用,比较局限,但是对于有类似“手势密码”功能的app来说,已经足够用了。有了这个新api,就可以在app中再多一种高大上的解锁方式了。 指纹验证功能的最低硬件支持为iPhone5s,iPad 6,iPad mini 3这些有t

smile全政的专栏 4876

杰理AC695N/AC696N/AC701N系列芯片在线调音教程

本教程详细介绍AC695N/AC696N/AC701N芯片在线音效调试方法,包括工具准备(需安装杰理包管理器)、程序修改(需关闭USB功能并启用在线调试宏)、连接方式(USB或串口)、音效调节步骤(EQ和混响参数调整)以及配置保存。注意事项包括版本匹配、连接检查和供电稳定等,并提供常见问题解决方案。适用于快速配置实时音效调试环境并保存最终配置。

qq_42014563的博客 1399

ios开发指纹解锁

1.首先引入指纹解锁必须的头文件#import 2.接下来判断手机是否支持指纹 这个方法是判断设备是否支持TouchID的: - (BOOL)canEvaluatePolicy:(LAPolicy)policy error:(NSError * __autoreleasing *) error __attribute__((swift_error(none))); 这个是用来验证TouchI

wangletiancsdn的博客 751

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

iOS开发实现TouchID指纹解锁

一直想实现一下指纹解锁,苦于一直没时间,最近终于闲了下来所以翻了翻文档看了看demo,完成了这篇教程。本功能实现起来是很简单的,因为苹果都已经帮我们封装好了,只需要实现几个方法就可以了。 实现效果图 实现过程 1.首先引入指纹解锁必须的头文件 1 LocalAuthentication/LocalAuthentication.h

风的坚持 905

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

ios与android指纹识别,iOS开发实现TouchID指纹解锁

一直想实现一下指纹解锁,苦于一直没时间,最近终于闲了下来所以翻了翻文档看了看demo,完成了这篇教程。本功能实现起来是很简单的,因为苹果都已经帮我们封装好了,只需要实现几个方法就可以了。实现效果图实现过程1.首先引入指纹解锁必须的头文件#import 2.了解下主要的两个方法这个方法是判断设备是否支持TouchID的。- (BOOL)canEvaluatePolicy:(LAPolicy)poli...

weixin_33253331的博客 572

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

iOS 开发 指纹识别解锁详解

#pragma mark - 指纹识别解锁 - (void)fingerprintIdentification { // 1.创建上下文 LAContext *context = [[LAContext alloc] init]; // 2.判断指纹识别是否可用 // LAPolicyDeviceOwnerAuthentication:在iOS9类型 可以输入密码

高级软件开发工程师--周玉的博客 1174

iOS开发之iOS8指纹解锁

首先:注意@import LocalAuthentication //判断指纹解锁是否可用 - (void)canEvaluatePolicy {     if ([[[UIDevice currentDevice] systemVersion] floatValue] >=8) {         LAContext *context = [[LAContext alloc] i

LGSC的IOS学习之路专栏 829

【源码】iOS指纹解锁Touch ID的开发

指纹解锁原理: 苹果在文件中对iPhone 5S配备的Touch ID指纹识别系统的功能与工作原理进行了详细说明。文件对iPhone 5S的A7处理器中““Secure Enclave””协处理器进行了说明,该协处理器能够安全地将用户储存的指纹信息与Touch ID当前所识别到的指纹进行信息对比。而苹果早在iPhone 5S发布时就公布了Touch ID的工作原理。但此次所获悉的文...

a524389222的博客 292
上一篇: Mac OS 每个版本的下载地址
下一篇: Mac App Store中的开发预览版软件更新如何关闭(如Safari 12.0 seed)
单细胞的逻辑
博客等级 码龄10年 19粉丝 48原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值