touch id vs face id

In our app we used to have a UISwitch for "use fingerprint in app". That doesn't make sense on an iPhone X. How are people handling the fact that authentication doesn't kmow if its fingerprint or face id? The human interface guidelines suggets you dom't prompt them and just assume they want it if the system level has it; but it also says to have buttons like "sign in with face id" instead of "sign in".

Accepted Answer

Use LABiometryType to identify the type of biometric authentication available on device.


https://developer.apple.com/documentation/localauthentication/labiometrytype

except that always returns "none"

It always return "none" on iOS 11 iPhone X simulator. The beta sdk (iOS 11.1) iOS simlator for iPhone X returns "typeFaceID"


Thanks,


Neal

that might be true, but on devices with touchid (iPhone 7 for example) it still returns none (tested on both iOS11 and 11.1 Beta)


edit: just tested on iPhone X simulator in Xcode 9.1 beta, it returns none even if i check "Enrolled" in hardware

edit2: evaluation still works though (i.e. authenticationContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) returns true) and SecItemCopyMatching gets me the expected result from keychain. The type is still ".none" though

Our app depends on the biometryType to determine whether our help dialogs should have the text "Touch ID" or "Face ID" embedded in it. It all works well.

Not clear why you're getting those results. I've verified that on a physical iPhone 7 Plus running iOS 11.1 beta gives this result:

(LABiometryType) type = LABiometryTypeTouchID.


I've also verified that on the iOS 11.1 iPhone X simulator give this result:

(LABiometryType) type = LABiometryTypeFaceID


Also tried the a simulated iPhone 7 running iOS 11.1 and the result was identical to the real iPhone 7 Plus device.

The only difference I see is that you are using Swift and our biometry code is in Objective C. However there's no way that is the source of the issue you're having. Perhaps do a simulator reset from the hardware menu and try again?


Thanks,


Neal

interesting... i will have to look into that.

Yes we are using Swift (4)



Edit: Still not working in Xcode 9.1 beta 2 and/or iOS 11.1 beta 2 with swift 4.0.1

Hi Pernilla,

you ensured that your app's info plist has the NSFaceIDUsageDescription key with a string value?

yes

you see face id works when evaluating, but the result of biometrytype is always none

my solution so far is to check deviceModel == iPhone10,3 || ... == ...10,6

You should call the canEvaluatePolicy:error: method before checking the biometryType property.

It works on Xcode9.0.1.

🙂

touch id vs face id
 
 
Q