How can I Enroll Touch ID in Simulator from the command line?

UPDATE May 2019: Read the accepted answer, that's the way to do it.

Original Answer from 2016: As far as I know there is no way to activate this on the simulator.

Generally, to test something like this, I fake a callback from the Apple component, or pop an alert view if there is no callback expected (like when calling openURL:, I'll pop an alert view with the URL that should be opened to verify the correct thing would be opened when opening that URL) while testing.

It feels kinda hacky, but it at least tells me that if the Apple component is giving me the expected callback, my application will take the expected action.

How do you tell if it's testing? Well, you've got a couple options.

Jon Reid's got a good post about how to tell if you're testing at runtime here: http://qualitycoding.org/app-delegate-for-tests/ - though he's using it to switch out the app delegate, I've used a similar technique to check whether the app is presently under test or not.

I'm not 100% sure this technique would work with Cucumber and Frank since I don't know if they run in the same process as the tests. For things not running in the same process as the tests (such as XCUI tests) I've passed in ProcessInfo arguments when the app is being launched so that it knows what to look for. Pain in the ass, and again, hacky, but it does seem to work.


xcrun simctl spawn 'iPhone X' notifyutil -s com.apple.BiometricKit.enrollmentChanged '1' && xcrun simctl spawn 'iPhone X' notifyutil -p com.apple.BiometricKit.enrollmentChanged

This will enroll fingerprint. Code taken from here

Edit: You can use this for finger touch:

xcrun simctl spawn 'iPhone X' notifyutil -p com.apple.BiometricKit_Sim.fingerTouch.match
xcrun simctl spawn 'iPhone X' notifyutil -p com.apple.BiometricKit_Sim.fingerTouch.nomatch