-2
this 자습서와 같은 지문을 모니터 할 수있는 방법을 알고 싶습니다. 그러나 그게 오래되어서 작동하지 않습니다.iOS 10에서 BiometricKit 프레임 워크를 사용하여 지문 모니터를 시작하려면 어떻게해야합니까?
미리 감사드립니다.
this 자습서와 같은 지문을 모니터 할 수있는 방법을 알고 싶습니다. 그러나 그게 오래되어서 작동하지 않습니다.iOS 10에서 BiometricKit 프레임 워크를 사용하여 지문 모니터를 시작하려면 어떻게해야합니까?
미리 감사드립니다.
jailbroken 장치에서 개인 BiometricKit 프레임 워크를 가지고 놀고 싶다면 실제로는 도움이되지 않습니다 ...
TouchID 기능을 사용하는 데 관심이있는 사용자는 공개 만하면됩니다 LocalAuthentication 프레임 워크.
#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
먼저 당신이 지문이 있는지 확인하십시오 :
은 여기에서 목표 - C에서 정말 기본적인 구현 MyViewController
, UIViewController
의 서브 클래스 (당신은 결국 거기에서 논리를 이동 할 수 있습니다)를 척입니다 기기에서 설정하십시오 (설정> 터치 ID & 비밀번호> 지문 섹션).