Skip to content

Commit 2ce863f

Browse files
committed
fix(ios): use updated API to query biometrics + pin fallback for ios 9 and above
the existing "LAPolicyDeviceOwnerAuthenticationWithBiometrics" is no longer recommended, and does not provide a pin/password fallback. The new "LAPolicyDeviceOwnerAuthentication" provides both as expected. But since this is only available on ios 9 and above - a fallback to the old way is included.
1 parent 4f8e3e2 commit 2ce863f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ios/RNBiometrics.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ @implementation RNBiometrics
3434
LAContext *context = [[LAContext alloc] init];
3535
context.localizedFallbackTitle = title;
3636

37-
[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:promptMessage reply:^(BOOL success, NSError *biometricError) {
37+
LAPolicy localAuthPolicy = LAPolicyDeviceOwnerAuthenticationWithBiometrics;
38+
if (![[UIDevice currentDevice].systemVersion hasPrefix:@"8."]) {
39+
localAuthPolicy = LAPolicyDeviceOwnerAuthentication;
40+
}
41+
42+
[context evaluatePolicy:localAuthPolicy localizedReason:promptMessage reply:^(BOOL success, NSError *biometricError) {
3843
if (success) {
3944
resolve( @(YES));
4045

0 commit comments

Comments
 (0)