首页 > 移动平台 > 详细

ios使用touchId

时间:2015-03-27 10:57:35      阅读:152      评论:0      收藏:0      [点我收藏+]

#import <LocalAuthentication/LAContext.h>




    LAContext *myContext = [[LAContext alloc] init];
    
    NSError *authError = nil;
    
    NSString *myLocalizedReasonString = @"请输入指纹";
    
    
    if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {//判断是否有指纹识别
        
        [myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
         
                  localizedReason:myLocalizedReasonString
         
                            reply:^(BOOL success, NSError *error) {
                                
                                if (success) {
                                    UIAlertView *al = [[UIAlertView alloc]initWithTitle:nil message:@"success" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles: nil];
                                    [al show];
                                    NSLog(@"success");
                                    // User authenticated successfully, take appropriate action
                                    
                                } else {
                                    UIAlertView *al = [[UIAlertView alloc]initWithTitle:nil message:@"失败" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles: nil];
                                    [al show];
                                    NSLog(@"faill");
                                    
                                }
                                
                            }];
        
    } else {
        
        // Could not evaluate policy; look at authError and present an appropriate message to user
        
    }


ios使用touchId

原文:http://blog.csdn.net/cerastes/article/details/44672301

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!