Xamarin.IOS TouchID Dialog Not Displaying On Actual Handset

Hello,

I have successfully implemented a TouchID authentication on both the iOS Simulator, and also my physical iPhone 8.
There's a slight difference in behaviour though between the two.

On the simulator - everything works like a charm.

On my actual physical phone, the TouchID dialog doesn't show up unless I very slightly push the home button, and then the TouchID dialog shows (and then works).

My code is not much different to the Xamarin docs (which I've added below).

And the trouble is, I know the code is OK - because it works great on the simulator! just a real device doesn't light up unless I touch the phone...

Has anyone ever seen this before?

if (context.CanEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, out AuthError)) {
    var replyHandler = new LAContextReplyHandler((success, error) => {

        // This will be called back after TouchID completed (success or fail)
        this.InvokeOnMainThread(() => {

            if (success) {
                loginResult = true;
                AppSession.User = new User(userName, accessToken);
                Main();
            } else {
                // Fall back to Auth0 manual login
                AuthenticateViaAuthZero();
            }

        });
    });

    context.EvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, myReason, replyHandler);


} else {
    // Fallback to Auth0
    Console.WriteLine("My App -- Cannot evaluate LAPolicy: " + AuthError.Description);
    AuthenticateViaAuthZero();
}

Best Answer

  • vitaexmachinavitaexmachina ✭✭
    Accepted Answer

    OK - I solved my own problem. Just dropping info here for reference.

    If you have your iphone device connected to your Mac - and actively watching the console log (using the XCode console viewer), the TouchID UI needs to be nudged by lightly pressing the home button.

    Not sure why, but a device not connected to the Mac works just fine.

Answers

  • vitaexmachinavitaexmachina Member ✭✭
    Accepted Answer

    OK - I solved my own problem. Just dropping info here for reference.

    If you have your iphone device connected to your Mac - and actively watching the console log (using the XCode console viewer), the TouchID UI needs to be nudged by lightly pressing the home button.

    Not sure why, but a device not connected to the Mac works just fine.

Sign In or Register to comment.