I am trying to authenticate the user using the device passcode. And I want to view the passcode board directly. But with the code below, I always have to go through the biometric authentication first and fail in order to authenticate with a passcode. How do I get the passcode board directly?
import UIKit
import LocalAuthentication
class ViewController: UIViewController {
@IBOutlet weak var userButton: UIButton!
@IBOutlet weak var resultLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func buttonPressed(_ sender: UIButton) {
authenticateUser()
}
func authenticateUser() {
let context = LAContext()
context.evaluatePolicy(LAPolicy.deviceOwnerAuthentication, localizedReason: "Please authenticate to proceed.") { (success, error) in
DispatchQueue.main.async {
if success {
self.resultLabel.text = "Success"
print("Success")
}else{
self.resultLabel.text = "Failed"
print("Failed")
return
}
}
}
}
}
Thank you