IOS8 get fingerprint data

2019-02-21 04:29发布

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

this Code to Authoticate

- (void)authenicateButtonTapped:(id)sender {
 LAContext *context = [[LAContext alloc] init];

 NSError *error = nil;
 if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
   [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
           localizedReason:@"Are you the device owner?"
                     reply:^(BOOL success, NSError *error) {

       if (error) {
           UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                           message:@"There was a problem verifying your identity."
                                                          delegate:nil
                                                 cancelButtonTitle:@"Ok"
                                                 otherButtonTitles:nil];
           [alert show];
           return;
       }

       if (success) {
           UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Success"
                                                           message:@"You are the device owner!"
                                                          delegate:nil
                                                 cancelButtonTitle:@"Ok"
                                                 otherButtonTitles:nil];
           [alert show];

       } else {
           UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                           message:@"You are not the device owner."
                                                          delegate:nil
                                                 cancelButtonTitle:@"Ok"
                                                 otherButtonTitles:nil];
           [alert show];
       }

   }];

  } 
    else {

   UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                   message:@"Your device cannot authenticate using TouchID."
                                                  delegate:nil
                                         cancelButtonTitle:@"Ok"
                                         otherButtonTitles:nil];
   [alert show];

  }
}

but i don't wont authenticate user , i wont get fingerprint data and send this data to server side , then server side will check on that fingerprint data .

2条回答
Juvenile、少年°
2楼-- · 2019-02-21 04:54

No you can not read or save fingerprint data. Even Apple does not collect this data. You can only use the Touch ID sensor to unlock your app with the fingerprints the user has already saved in the system preferences.

查看更多
劳资没心,怎么记你
3楼-- · 2019-02-21 05:01

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

enter image description here

查看更多
登录 后发表回答