Skip to content

PLUGIN - local_auth returning empty array for .getAvailableBiometrics() for iOS Simulator device #25635

@sjmcdowall

Description

@sjmcdowall

I upgraded to the latest local_auth and tried out the new routines .canCheckBiometrics() and then if true, .getAvailableBiometrics().

However, when I run on an iOS iPhone XR Simulator (for example) I am getting an empty array for the .getAvailableBiometrics() but the .canCheckBiometrics() returns true (as one would expect).

Here is the code (snippet):

else if (Platform.isIOS) {
        deviceData = _readIosDeviceInfo(await deviceInfoPlugin.iosInfo);
        _setiOSDeviceInfo();

        // Do the Bio check
        hasBiometrics = await localAuth.canCheckBiometrics;
        print('[Device - init() IOS] - hasBiometrics is $hasBiometrics');
        if (hasBiometrics) {
          // iOS is a bit more complex since it can be either Touch or Face ID
          List<BiometricType> availableBiometrics =
              await localAuth.getAvailableBiometrics();

          print('[Device - init() IOS] - Available Biometrics are:');
          print(availableBiometrics);
          if (availableBiometrics.contains(BiometricType.face)) {
            print('[Device - init() IOS] - Found FaceID biometrics');
            biometricType = 'Face ID';
          } else if (availableBiometrics.contains(BiometricType.fingerprint)) {
            print('[Device - init() IOS] - Found TouchID biometrics');
            biometricType = 'Touch ID';
          } else {
            print('[Device - init() IOS] - Didn' 't find any biometrics??');
            biometricType = 'Unknown';
          }
        }
      }

And the result of run (i.e. the debug) --

flutter: [Device - setiOS()] - machineName is iPhone XR
flutter: [Device - setiOS()] - machineType is x86_64
flutter: [Device - setiOS()] - SIM platform is iPhone10
    1000 = 1;
}, (null) on <LAClient: 0x600003e96490>
flutter: [Device - init() IOS] - hasBiometrics is true
    1000 = 1;
}, (null) on <LAClient: 0x600003e93160>
flutter: [Device - init() IOS] - Available Biometrics are:
flutter: []
flutter: [Device - init() IOS] - Didnt find any biometrics??

This works on Android just fine -- and real iOS devices connected to USB (or via TestFlight etc).

Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    p: local_authPlugin for local authentificationpackageflutter/packages repository. See also p: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions