iPhone 생체인증(Biometrics) 지원여부 확인
2021. 3. 12. 11:32ㆍ개발자료/iOS
반응형
## 생체인증(Biometrics) 지원여부
- (BOOL) isSupportBiometric {
if (![LAContext class]) {
return NO;
}
LAContext *laContext = [[LAContext alloc] init];
NSError *error = nil;
if (![laContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
return NO;
}
return YES;
}
## 지문인증(TouchID) 지원여부
- (BOOL) isSupportTouchID {
if (![LAContext class]){
return NO;
}
LAContext *laContext = [[LAContext alloc] init];
NSError *error = nil;
if (![laContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
return NO;
}
if (@available(iOS 11.0, *)) {
if (laContext.biometryType == LABiometryTypeTouchID){
return YES;
} else {
return NO;
}
}
return YES;
}
## 안면인증(FaceID) 지원여부
- (BOOL) isSupportFaceID {
if (![LAContext class]){
return NO;
}
LAContext *laContext = [[LAContext alloc] init];
NSError *error = nil;
if (![laContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
return NO;
}
if (@available(iOS 11.0, *)) {
if (laContext.biometryType == LABiometryTypeFaceID){
return YES;
} else {
return NO;
}
}
return NO;
}
반응형
'개발자료 > iOS' 카테고리의 다른 글
info.plist (0) | 2021.04.08 |
---|---|
NSURL (0) | 2021.04.08 |
[Application] The app delegate must implement the window property if it wants to use a main storyboard file. (0) | 2021.03.09 |
[Swift] String (0) | 2020.12.16 |
[WARNING] Null passed to a callee that requires a non-null argument (0) | 2020.12.03 |