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. 习水医院12C RAC 数据库安装文档

        环境介绍 OS: Oracle Enterprise Linux 6.4 (For RAC Nodes) DB: GI and Database 12.1.0.2 所需介质 p17694377 ...

  2. Android(java)学习笔记197:ContentProvider使用之内容观察者02

    下面通过3个应用程序之间的交互说明一下内容观察者: 一. 如下3个应用程序为相互交互的: 二.交互逻辑图: 三.具体代码: 1.   16_数据库工程: (1)数据库帮助类BankDBOpenHelp ...

  3. Python list列表的常用操作方法

    本文主要介绍了Python中列表(List)的详解操作方法,包含创建.访问.删除.排序.切片,乘等操作方法 1.创建列表:把逗号分隔的不同的数据项使用方括号括起来 list = [1,2,3,'Jam ...

  4. close - 关闭一个文件描述符

    SYNOPSIS 总览 #include <unistd.h> int close(int fd); DESCRIPTION 描述 close 关闭 一个 文件 描述符 , 使它 不在 指 ...

  5. spring的设计思想

    在学习Spring框架的时候, 第一件事情就是分析Spring的设计思想 在学习Spring的时候, 需要先了解耦合和解耦的概念 耦合: 简单来说, 在软件工程当中, 耦合是指对象之间的相互依赖 耦合 ...

  6. JavaSE-05 数组

    学习要点 数组的基本用法 数组的典型应用 数组相关概念 问题 Java考试结束后,老师给小强分配了一项任务,让他计算全班(30人)的平均分,按照目前的知识结构,如何实现? 问题分析 数组 定义:数组是 ...

  7. JAVA基础——数据流

    DataInputStream 类和DataOutputStream 类 在前面的学习中,我们知道数据流处理的数据都是指字节或字节数组,但实际上很多时候不是这样的,它需要数据流能直接读.写各种各样的j ...

  8. http返回状态码错误

    415 数据格式不正确 415 Unsupported Media Type 服务器无法处理请求附带的媒体格式 后台用json接收 1.将表单数据转换成json数据 2.设置contentType:& ...

  9. Python之爬虫-中国大学排名

    Python之爬虫-中国大学排名 #!/usr/bin/env python # coding: utf-8 import bs4 import requests from bs4 import Be ...

  10. Hadoop2.x异常总结

    问题1: 在执行bin/hdfs namenode -format格式化HDFS命令时,抛出异常,异常如下: 16/10/26 18:32:45 ERROR namenode.NameNode: Fa ...