无法识别的选择器已发送到实例0x108b08740

时间:2019-02-28 18:54:29

标签: ios swift xcode

Янемогуисправитьэтуошибку。 Помогитепожалуйста。 Заранееблагодарен

我无法解决此错误。请帮帮我。预先感谢。

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
        }
    }
}

0 个答案:

没有答案