IOS8 get fingerprint data

前端 未结 2 1181
隐瞒了意图╮
隐瞒了意图╮ 2021-01-16 19:15

in IOS8 can i take the fingerprint data and save it or use it somewhere else ,

this Code to Authoticate

- (void)authenicateButtonTapped:(id)sende         


        
2条回答
  •  误落风尘
    2021-01-16 19:35

    You can authenticate like this way:

     func authenticateUser() {
        let context = LAContext()
        var error: NSError?
    
        if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
            let reason = "Identify yourself!"
    
            context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reason) {
                [unowned self] success, authenticationError in
    
                DispatchQueue.main.async {
                    if success {
                        let ac = UIAlertController(title: "Login with TouchID", message: "Sucessfully Login", preferredStyle: .alert)
                        ac.addAction(UIAlertAction(title: "OK", style: .default))
                        self.present(ac, animated: true)
                    } else {
                        let ac = UIAlertController(title: "Authentication failed", message: "Sorry!", preferredStyle: .alert)
                        ac.addAction(UIAlertAction(title: "OK", style: .default))
                        self.present(ac, animated: true)
                    }
                }
            }
        } else {
            let ac = UIAlertController(title: "Touch ID not available", message: "Your device is not configured for Touch ID.", preferredStyle: .alert)
            ac.addAction(UIAlertAction(title: "OK", style: .default))
            present(ac, animated: true)
        }
    }
    

提交回复
热议问题