It has been quite a while since Apple Inc. provided the fingerprint authentication API for developers to use the amazing feature “Touch ID” in their own apps, but it’s still hard for us to find out any Touch ID supported apps in App Store. This post will provide you a chance to touch this new authentication method and enable it in your apps.
First of all, you need Xcode V6.1 and iOS sdk 8, and you need to make sure your develop iPhone is an iPhone 5s or above.
Second, add the Authentication API into your code (put it in your xxx.m file). I recommend to put it between “imports” and “interface” line.
Third, you need to decide where you should put codes to call this awesome fingerprint authentication method. From my experience, I prefer to call the authentication function inside the “remember me” method in the sign-in page. That way, the touch ID popup will only appear when a user chooses to remember their username and password in the sign-in page.
Choosing a Global Software Development Partner to Accelerate Your Digital Strategy
To be successful and outpace the competition, you need a software development partner that excels in exactly the type of digital projects you are now faced with accelerating, and in the most cost effective and optimized way possible.
The code would like this:
Here I use NSFoundationVersionNumber_iOS_7_1 to make sure a device got the ability to use the touch id, as Apple only put the fingerprint detect hardware in iPhone 5s and above (aka: iPhone 5s, iPhone 6, iPhone 6 plus, iPad, etc.)
Last but not the least, we need to write the “callTheFrigerPrinterAuth” function. Here is my own sample codes:
If Apple detects the fingerprint correctly, then it will call the “Sign in” function to let user log in. Otherwise, it won’t do anything.
At this point, you are almost there. Here is what the output should look like in an iPhone:
Once you see this view in your iPhone, just put your finger in the “Home” button, and Apple will allow you to log in without typing username and password every time.
Apple Touch ID allows users to log in with their fingerprints if they’ve already chosen to remember their passwords in the app. By using this function, the application could improve the security level of a single C/S type application.