Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we test Face ID in simulator?

Can we test biometric authentication using the simulator?

The iPhone X Simulator shows a menu for Face ID enrollment, but after enabling that, what can I do?

How it will recognize a face for authentication?

iPhone X Simulator - Face ID settings

like image 837
technerd Avatar asked Nov 07 '17 13:11

technerd


People also ask

How do you inspect Iphone Simulator?

You'll need to go to Settings > Advanced and check the Show Debug Menu option. Then you'll see the option to open the web inspector for the Simulator right from that menu. With the Web Inspector open, you can debug inside the Simulator just like you could right in a desktop browser with DevTools.

Does Face ID have AI?

Open your phone with face ID And, when your device gets unlocked using biometrics such as with face ID, it's using artificial intelligence to enable that functionality. Apple's FaceID can see in 3D. It lights up your face and places 30,000 invisible infrared dots on it and captures an image.

How do you open the camera in iOS Simulator?

It's not possible to access the camera of your development machine to be used as the simulator camera. Camera functionality is not available in any iOS version and in any Simulator. You will have to use a real device for camera testing purposes.


2 Answers

The simulator just simulates the outcome of a correct and a failed face recognition, just like it does with Touch ID. It does not recognize faces.

like image 21
Tamás Sengel Avatar answered Sep 28 '22 03:09

Tamás Sengel


Simulator does not recognise a face but allows you to simulate a matching and non-matching faces, if you've enabled Enrolled option from Face ID.


Add following code to your view controller and try with Face-ID

import LocalAuthentication  class ViewController: UIViewController {       override func viewDidLoad() {         super.viewDidLoad()         localAuthentication()     }        func localAuthentication() -> Void {          let laContext = LAContext()         var error: NSError?         let biometricsPolicy = LAPolicy.deviceOwnerAuthenticationWithBiometrics          if (laContext.canEvaluatePolicy(biometricsPolicy, error: &error)) {              if let laError = error {                 print("laError - \(laError)")                 return             }              var localizedReason = "Unlock device"             if #available(iOS 11.0, *) {                 if (laContext.biometryType == LABiometryType.faceID) {                     localizedReason = "Unlock using Face ID"                     print("FaceId support")                 } else if (laContext.biometryType == LABiometryType.touchID) {                     localizedReason = "Unlock using Touch ID"                     print("TouchId support")                 } else {                     print("No Biometric support")                 }             } else {                 // Fallback on earlier versions             }               laContext.evaluatePolicy(biometricsPolicy, localizedReason: localizedReason, reply: { (isSuccess, error) in                  DispatchQueue.main.async(execute: {                      if let laError = error {                         print("laError - \(laError)")                     } else {                         if isSuccess {                             print("sucess")                         } else {                             print("failure")                         }                     }                  })             })         }       } } 

FaceID authentication will prompt you for first time to allow FaceID detection for your app.

enter image description here


Now enable Face ID enrolment and run your app to test Face ID simulation Testing.

Here is simulation result for matching and non-matching faces.

Result for matching face:

enter image description here


Result for non-matching face:

enter image description here


like image 153
Krunal Avatar answered Sep 28 '22 03:09

Krunal