【问题标题】:IOS Fingerprint implementationIOS指纹实现
【发布时间】:2013-09-23 07:16:37
【问题描述】:

由于 Apple 已经在 iOS 7 中发布了具有指纹扫描功能的 Xcode 5,我们可以在我们的应用程序中实现它吗?如果是,我们使用哪个 SDK 来实现。

请提供示例代码或指定我们使用哪个 SDK。

【问题讨论】:

标签: ios ios7 xcode5 fingerprint


【解决方案1】:

没有指纹扫描仪对开发人员不可用,它在当前的 SDK 中可用。

借助即将推出的 iOS 8 SDK,您将能够通过官方 SDK 使用指纹扫描仪。

您可以在What's New in iOS: iOS8 文档中阅读有关 TouchID 的更多信息。

【讨论】:

  • 这在 iOS 8 中有所改变。
  • @Zaph 你是对的,但是由于我不会在每次发布新 SDK 时都浏览所有帖子并更改它们,所以这个答案不会更新。
【解决方案2】:

这可以通过使用 LAContext本地身份验证框架)来实现,该框架可用于评估安全策略。它使用 Touch ID 传感器检查验证人是设备所有者。将来可能会有其他安全策略。

这是相同的代码sn-p:

-(void)handlerForFingerTouch{
   LAContext *context = [[LAContext alloc] init];

   NSError *error = nil;
   if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
       [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
               localizedReason:@"Are you the device owner?"
                         reply:^(BOOL success, NSError *error) {

           if (error) {
               UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                               message:@"There was a problem verifying your identity."
                                                              delegate:nil
                                                     cancelButtonTitle:@"Ok"
                                                     otherButtonTitles:nil];
               [alert show];
               return;
           }

           if (success) {
               UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Success"
                                                               message:@"You are the device owner!"
                                                              delegate:nil
                                                     cancelButtonTitle:@"Ok"
                                                     otherButtonTitles:nil];
               [alert show];

           } else {
               UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                               message:@"You are not the device owner."
                                                              delegate:nil
                                                     cancelButtonTitle:@"Ok"
                                                     otherButtonTitles:nil];
               [alert show];
           }

       }];

   } else {

       UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                       message:@"Your device cannot authenticate using TouchID."
                                                      delegate:nil
                                             cancelButtonTitle:@"Ok"
                                             otherButtonTitles:nil];
       [alert show];

   }
}

【讨论】:

    猜你喜欢
    • 2023-03-16
    • 1970-01-01
    • 1970-01-01
    • 2012-04-19
    • 1970-01-01
    • 1970-01-01
    • 2019-01-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多