3

The following code will show a alert while authenticating. I want that this authentication should happen in background, just as when we unlock iPhone's passcode lock using touch id.

  func touchidcheck(){
            let authcontext:LAContext=LAContext()
            var error:NSError?
         if   authcontext.canEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, error: &error){
            authcontext.evaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, localizedReason: "Testing", reply: {
                (wasSuccessful:Bool, error:NSError?) in
                if wasSuccessful{
                    print("Yes")}

                else
                {
                    print("No")
                }
                }
            )
        }

        }
MBajaj
  • 67
  • 7

0 Answers0