Skip to main content

Development

How to set up Apple Touch ID for your own apps

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.

01

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.

02

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.

03

The code would like this:

04

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:

05

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:

06

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.

References:

https://developer.apple.com/ios8/

https://developer.apple.com/library/ios/documentation/LocalAuthentication/Reference/LocalAuthentication_Framework/

Thoughts on “How to set up Apple Touch ID for your own apps”

  1. That is really fascinating, You are a very skilled blogger. I’ve joined your feed and sit up for in search of more of your fantastic post. Also, I’ve shared your web site in my social networks

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories
Follow Us
TwitterLinkedinFacebookYoutubeInstagram