1

I use the following code to authenticate user in my application

        let mycontext = LAContext()
    let authenticatonString = ""

    var authError :NSError? = nil

    if #available(OSX 10.12, *) {
        if mycontext.canEvaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, error: &authError) {
            mycontext.evaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, localizedReason: authenticatonString, reply: { (sucess, evaluationError) in
                if sucess == true {
                    self.resultLabel.stringValue = "authenticated successfully"
                } else {
                    print("error reason : \(evaluationError?.localizedDescription)")
                    self.resultLabel.stringValue = (evaluationError?.localizedDescription)!
                }
            })
        } else {
            self.resultLabel.stringValue = "touch id not available; so show passcode dialog"
        }
    } else {
        self.resultLabel.stringValue = "older version of osx; so show passcode dialog"
    }

Event though the touch id methods are available from osx 10.12, the canEvaluatePolicy methods crashed in osx 10.12 and 10.12.1 with error

Error Domain=com.apple.LocalAuthentication Code=-1001 "Unknown policy: '1'" UserInfo={NSLocalizedDescription=Unknown policy: '1'}

The LAPolicy.deviceOwnerAuthenticationWithBiometrics is also available from 10.12

I'd like to know what is going wrong with the evaluation

miken32
  • 42,008
  • 16
  • 111
  • 154
Bhargavi
  • 515
  • 4
  • 14
  • 1
    I'm encountering this issue too. I posted on Apple's developer forums about it: https://forums.developer.apple.com/thread/71930 with no resolution as of yet – Tap Forms Feb 04 '17 at 04:34

0 Answers0