LAContext has method to check if device can evaluate touch ID and gives error message. Problem is that same error message \"LAErrorPasscodeNotSet\" is given by system in two cas
In Swift 3
fileprivate func deviceSupportsTouchId(success: @escaping () -> (), failure: @escaping (NSError) -> ()) {
let context = LAContext()
var authError: NSError?
let touchIdSetOnDevice = context.canEvaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, error: &authError)
if touchIdSetOnDevice {
DispatchQueue.main.async {
success()
}
}
else {
DispatchQueue.main.async {
failure(error!)
}
}
}
deviceSupportsTouchId() return Success if the device has touch Id capability.
If not then, function will return error, giving you the following error code if touchIDNotEnrolled is not set yet.
LAError.Code.touchIDNotEnrolled.rawValue
You can handle it using this value.