我无法解决此错误。请帮帮我。预先感谢。
P.S我试图仅通过Face ID或Touch ID锁定视图控制器。 P.S viewпытаюсьзаблокировать视图控制器спомощьюFace IDилиTouch IDтолько。
import UIKit
import LocalAuthentication
class ViewController123: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func touchID(_ sender: Any) {
let context:LAContext = LAContext()
if context.canEvaluatePolicy(.deviceOwnerAuthentication, error: nil)
{
context.evaluatePolicy(LAPolicy.deviceOwnerAuthentication, localizedReason: "Login", reply: { (wasCorrect, error) in
if wasCorrect {
print("OK")
}
else
{
print("F")
}
})
}
else
{
//This device does not support Face ID or Touch ID
}
}
}