Released with iOS 7, Touch ID allows iPhone 5S and iPad Air users to authenticate with their fingerprint, until now only for AppStore purchases and device unlocking. With iOS 8, Apple released a public API that allows a developer to implement Touch ID authentication in a private app.

First include LocalAuthentication framework into your app via Target > Build Phases > Link Binary With Libraries.

LocalAuthentication framework

Once it’s done, this code snippet prompts the user to either authenticate via Touch ID, or via password, and the callback give you the process result.

However, Apple specifies you must provide the very good reason why you’re requesting the user to authenticate in your app ; moreover, the UX impact is significant so that you may use this feature only when there is a clear necessity to.

Partager