From the course: iOS Development: Security

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Implementing the authentication logic

Implementing the authentication logic - iOS Tutorial

From the course: iOS Development: Security

Start my 1-month free trial

Implementing the authentication logic

- [Instructor] Next, let's implement the authentication logic. The local authentication API is simple and straightforward. I call the authentication context, Evaluate Policy Method. It's an asynchronous method and it involves prompting the user for authentication. We need to provide the policy to evaluate, which again is LAPolicy deviceOwnerAuthenticationWithBiometrics. The localized reason parameter should be a localized message. Let's say Log in with your Touch ID. The system displays this message in the authentication dialog presented to the user. The third parameter is the reply closure that's executed when the evaluation finishes. The closure has a Boolean parameter that indicates whether the policy evaluation succeeded and an optional error, which is nil if there were no problems. Let's call it success and error. For this demo, I'm going to pop up an alert view showing if the authentication was successful or not. So, I create two string variables for the title and the message…

Contents