欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

IOS 指紋識(shí)別兩種方式詳解及實(shí)例

 更新時(shí)間:2017年06月21日 15:10:51   作者:IOS_Mainstay  
這篇文章主要介紹了IOS 指紋識(shí)別兩種方式詳解及實(shí)例的相關(guān)資料,需要的朋友可以參考下

IOS 指紋識(shí)別兩種方式詳解及實(shí)例

首先引入類名:

#import <LocalAuthentication/LocalAuthentication.h>

然后在實(shí)現(xiàn)指紋識(shí)別的地方放入如下代碼:

方式一:

LAContext *lacontext = [[LAContext alloc]init];
  // 判斷設(shè)備是否支持指紋識(shí)別
  BOOL isSupport = [lacontext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:NULL];
  if(!isSupport)
  {
    NSLog(@"不支持!");
    return;
  }
  [lacontext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"請(qǐng)按下手印" reply:^(BOOL success, NSError *error) {
    if(success)
    {
      NSLog(@"成功后,處理接下來(lái)的邏輯");
    }
  }];

iPhone 5s推出指紋識(shí)別, 在 iOS 8.0 蘋果開放了指紋識(shí)別的 SDK

最重要的應(yīng)用領(lǐng)域是支付

方式二:

if ([UIDevice currentDevice].systemVersion.floatValue < 8.0) {
    NSLog(@"不支持");
    return;
  }

  LAContext *ctx = [[LAContext alloc] init];
  // 判斷設(shè)備是否支持指紋識(shí)別
  if ([ctx canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:NULL]) {
    NSLog(@"支持");
    // 輸入指紋,異步
    // 提示:指紋識(shí)別只是判斷當(dāng)前用戶是否是手機(jī)的主人!程序原本的邏輯不會(huì)受到任何的干擾!
    [ctx evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"指紋登錄" reply:^(BOOL success, NSError *error) {
      if (success) {
        // 登錄成功
        // TODO
        NSLog(@"登陸成功");
      }
    }];
  } else {
    NSLog(@"不支持");
  }

感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!

相關(guān)文章

最新評(píng)論