One of the most things I was excited about iOS 8 was the ability to use fingerprint sensors on the iPhone 5s and later. Unfortunately I cannot find out what is the required framework for that, nor how I can make authentication. Please help me with:
- What framework required for using Touch ID?
- How to use its methods and how to authenticate the user?
A code sample would be much appreciated.
The Local Authentication framework provides facilities for requesting authentication from users using Touch ID, following code snipped shows how you should request for authentication.
Objective C
Swift
You're looking for LocalAuthentication framework (login may be required to see).
Basically you're interested in LAContext class and its
canEvaluatePolicy:error:
andevaluatePolicy:localizedReason:reply:
methods.The
canEvaluatePolicy:error:
method is used to check if TouchID authentication is available for you to use.And use
evaluatePolicy:localizedReason:reply:
to perform actual authentication checkSwift 3 version of @txulu response:
I was looking for an answer in objectiveC with all the possible errors. Didn't find on this post so here it is.
Also make sure to use dispatch_async otherwise your uialert messages will not pop-up on time. See sample code below
More complete snippet, swift style:
Source