Using Biometrics on iOS
I recently had to dig into biometrics on iOS and thought I would write some things down, mainly for the benefit of Future Me.
Apple’s documentation has a good walkthrough of how to use biometrics to authenticate a user in your app. The process boils down to:
NSFaceIDUsageDescriptionto your app’s
Info.plist. This string is shown the first time your app attempts to use Face ID. If you don’t include it, your app will crash at this point.
- Create a
LAContextobject. See the note below about the expected lifetime of this object.
- Check what functionality is available on the device. You do this by calling
LAContextand passing the desired
- Once you have called
biometryTypeis populated on the
LAContextwhich indicates what biometrics are supported on the device. You can use this to update your UI (e.g. show...
Continue reading →