From the course: Biometric Authentication for iOS in Swift

Unlock the full course today

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

Authentication fails

Authentication fails

From the course: Biometric Authentication for iOS in Swift

Start my 1-month free trial

Authentication fails

- [Instructor] So we looked at handling errors for the evaluatePolicy. It gets a closure, and that passes in an error in case something went wrong, but what about if they get a false back from canEvaluatePolicy? Well that's why we passed in this errorCanEval. It'll get set if an error occurred, and we can check that in the else. It's very similar to the case where we checked the error for evaluatePolicy, so we'll actually just copy that if from line 43 to 56, and paste it under line 61. We're checking the error, but now we need to be checking the errorCanEval, so I'm going to copy that and paste it over the error. Now of course we don't want to check for things like use or cancel, because they didn't even go to the authentication, so we want to check for things like NotEnrolled, and then we can handle it accordingly. You might pop up a message to the user to go enroll, or you might send them directly to the settings app. If we unenrolled now and ran this, we would be able to see that…

Contents