iOS8新增了LocalAuthentication框架,用于TouchID的授权使用。亲測,眼下须要用户的设备支持指纹识别并已设置锁屏,并且实际測试过程中反馈比較慢。不能直接跟第三方账号password绑定,假设须要实现第三方应用直接指纹识别登录,须要在本地存储账号信息,指纹识别通过之后再从本地读取账号信息登录。总之。眼下的指纹识别是跟设备、设备锁屏password绑定的。

測试代码:

///使用TouchID
-(void)usingTouchID
{
LAContext *myContext = [[[LAContext alloc] init] autorelease];
NSError *authError = nil;
NSString *myLocalizedReasonString = @"用于指纹登录";
if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:myLocalizedReasonString
reply:^(BOOL success, NSError *error) {
if (success) {
// User authenticated successfully, take appropriate action
NSLog(@"成功");
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:@"Suceess" message:@"已通过指纹识别。" delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil] autorelease];
[alertView show];
} else {
// User did not authenticate successfully, look at error and take appropriate action
NSLog(@"fail with error:%@",error);
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:@"Failed" message:[error localizedDescription] delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil] autorelease];
[alertView show];
}
}];
} else {
// Could not evaluate policy; look at authError and present an appropriate message to user
NSLog(@"auth with error:%@",authError);
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:@"Failed" message:[authError localizedDescription] delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil] autorelease];
[alertView show];
}
}

iOS8使用TouchID的更多相关文章

  1. iOS8指纹识别TouchID

    苹果在2014年6月3日的WWDC2014开幕式上推出了新版iOS8系统,界面上iOS8与iOS7相比变化不大,只是在功能方面进行了完好.iOS8通知中心更加强大,支持消息直接回复操作,并支持Quic ...

  2. IOS8 TouchID使用介绍

    本文转载至 http://blog.csdn.net/jinkaiouyang/article/details/35555123 IOS8将指纹识别技术开放出来了.我们能够利用用户设置的touch I ...

  3. CoreBluetooth - TouchID应用

    支持系统和机型: iOS系统的指纹识别功能最低支持的机型为iPhone 5s,最低支持系统为iOS 8, 虽然安装iOS 7系统的5s机型可以使用系统提供的指纹解锁功能,但由于API并未开放,所以理论 ...

  4. ios8指纹识别

    简介 苹果从iPhone5S开始,具有指纹识别技术,从iOS8.0之后苹果允许第三方 App 使用 Touch ID进行身份验证.指纹识别Touch ID提供3+2共5次指纹识别机会(3次识别失败后, ...

  5. iOS TouchID & FaceID

    import UIKit import LocalAuthentication //指纹识别必须用真机测试,并且在iOS8以上系统,如果是FaceID至少IOS11以上. class Authenti ...

  6. iOS 指纹解锁 验证TouchID

    iOS指纹解锁 1.首先,引入依赖框架 LocalAuthentication.framework #import <LocalAuthentication/LocalAuthenticatio ...

  7. iOS7,iOS8和iOS9的区别

    iOS7,iOS8和iOS9的区别:iOS7.0 1.iOS 7是iOS面世以来在用户界面上做出改变最大的一个操作系统.iOS 7抛弃了以往的拟物化设计,而采用了扁平化设计. 苹果在重新思考 iOS ...

  8. TouchID 指纹解锁

    概述 TouchID 指纹解锁 详细 代码下载:http://www.demodashi.com/demo/10701.html 一.软硬件支持 指纹验证功能的最低硬件支持为iPhone5s, iPa ...

  9. iOS8沙盒路径的变化

    iOS8中的的沙盒路径发生了变化 之前是这样的路径,通过NSHomedictionary()获取的家路径 /Users/wupeng/Library/Application Support/iPhon ...

随机推荐

  1. iOS UI 顶级布局

    状态栏. 导航栏. tabbar. uiviewcontroller视图区域.

  2. libevent学习之网络通信

    服务器端要实现网络通信,肯定会用到socket等函数,这几个函数应该没什么问题.libevent默认情况下是单线程的,可以配置成多线程,每个线程有一个event_base,对应一个struct eve ...

  3. H5 canvas pc 端米字格 写字板

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  4. Java SE、Java EE、Java ME 三者区别

    现在一个个来分析 1. Java SE(Java Platform,Standard Edition).Java SE 以前称为 J2SE.它允许开发和部署在桌面.服务器.嵌入式环境和实时环境中使用的 ...

  5. Linux C下变量和常量的存储的本质

    源代码 #cat main.c #include <stdio.h> int i = 100; int main(void) { func(); return 0; } #cat func ...

  6. Hadoop架构模型

    1.hadoop 1.x架构模型:分布式文件存储系统:HDFSNameNode(主节点:管理元数据) secondaryNameNode(作用是合并元数据信息,辅助NameNode管理元数据信息)Da ...

  7. Android Bitmap详细介绍(3)

    package com.testbitmapscale; import java.io.File; import java.io.FileInputStream; import java.io.Fil ...

  8. LeetCode(29)Divide Two Integers

    题目 Divide two integers without using multiplication, division and mod operator. If it is overflow, r ...

  9. 13-看图理解数据结构与算法系列(Trie树)

    Trie树 Trie树,是一种搜索树,也称字典树或单词查找树,此外也称前缀树,因为某节点的后代存在共同的前缀.它的key都为字符串,能做到高效查询和插入,时间复杂度为O(k),k为字符串长度,缺点是如 ...

  10. First C program

    come from https://mooc.study.163.com/learn/1000002011?tid=2001530003#/learn/content?type=detail& ...