简体   繁体   English

如何在 ios 10 theos 中使用 BiometricKit 框架开始监控指纹?

[英]How do I start monitor for finger prints using BiometricKit framework in ios 10 theos?

I would like to know how to start monitor for finger prints like this tutorial explains but it is out of date so it doesnt work.我想知道如何像教程解释的那样启动指纹监测,但它已过时,因此无法正常工作。

Thanks in advance.提前致谢。

If you want to play around with the private BiometricKit framework on a jailbroken device I can't really help...如果你想在越狱设备上使用私有的 BiometricKit 框架,我真的无能为力......
If you're only interested in leveraging the TouchID functionality though, you only need to use the public LocalAuthentication framework.如果您只对利用 TouchID 功能感兴趣,则只需使用公共LocalAuthentication框架。

Here's a really basic implementation in Objective-C in a pretend MyViewController , subclass of UIViewController (You might eventually want to move the logic out of there):这是一个在 Objective-C 中的一个非常基本的实现,在一个假装的MyViewControllerUIViewController子类(你可能最终想要将逻辑移出那里):

#import "MyViewController.h"
@import LocalAuthentication;

@interface MyViewController ()
@property (nonatomic, strong) LAContext *localAuthContext;
@end


@implementation MyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self authenticateWithTouchID]; // Call this whenever TouchID authentication is required.
}

#pragma mark - TouchID Authentication

- (void)authenticateWithTouchID {
    NSError *evaluationError;
    if (![self.localAuthContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&evaluationError]) {
        // TODO: Handle error case. (device with no TouchID capability)
        NSLog(@"%@", evaluationError.localizedDescription);
    } else {
        [self.localAuthContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
                              localizedReason:@"Authenticate using Touch ID"
                                        reply:^(BOOL success, NSError *error) {

                                            if (!success) {
                                                // TODO: Handle error case. (failed TouchID authentication)
                                                NSLog(@"%@", error.localizedDescription);
                                            } else {
                                                // TODO: Handle success case.
                                                NSLog(@"TouchID authentication successful.");
                                            }
                                        }];
    }
}

#pragma mark - Lazy Instantiation

- (LAContext *)localAuthContext
{
    if (!_localAuthContext) {
        _localAuthContext = [[LAContext alloc] init];
        _localAuthContext.localizedFallbackTitle = @""; // Hides the "Enter Password" button. Comment out to allow the user to enter his device passcode as a fallback option.
    }
    return _localAuthContext;
}

@end

First make sure that you have a fingerprint set up on your device (Settings > Touch ID & Passcode > Fingerprints section).首先确保您在设备上设置了指纹(设置 > 触控 ID 和密码 > 指纹部分)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Theos中向UIStatusBar添加子视图? - How do I add a subview to UIStatusBar in Theos? 如何让我的UISwitch调用此方法? (使用theos) - How can I get my UISwitch to call this method? (using theos) 如何使用“顺序手指检测”的新iOS 9.2 Touch ID功能 - How do I use the new iOS 9.2 Touch ID feature of “sequential finger detection” 如何忽略屏幕上多余的手指? - How do I ignore an extra finger on the screen? 如何制作我的UISwitch调用方法(我在使用theos) - How can I make my UISwitch call method (I'm using theos) iOS模拟器:如何在Mac笔记本电脑上进行2指单击? - iOS simulator: how to do a 2 finger single tap on a mac laptop? 如何获取UIButton来调用目标类并挂钩此方法? (使用theos编译越狱调整) - How can I get UIButton to call target class and hook this method? (using theos to compile jailbreak tweak) 使用theos挂钩到iOS中的实例方法,并检索要传递的参数 - Hook to an instance method in iOS using theos and retrieve the argument that is being passed 如何在iOS 10 UserNotifications上设置NSCalendarUnitMinute repeatInterval? - How do I set an NSCalendarUnitMinute repeatInterval on iOS 10 UserNotifications? 如何创建特定于我的需求的新iOS框架? - How do I create a new iOS framework specific to my needs?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM