iOS8 check if device has Touch ID

后端 未结 5 622
不思量自难忘°
不思量自难忘° 2021-02-12 23:50

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

5条回答
  •  爱一瞬间的悲伤
    2021-02-13 00:08

    You can find out if a device supports Biometric scanning (touchID and faceID) by checking the error code as shown below:

    func deviceSupportsBiometricScanning() -> Bool {
        var authError: NSError?
        let _ = LAContext().canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &authError)
        return authError?.code != kLAErrorBiometryNotAvailable.hashValue
    }
    

提交回复
热议问题