This is not a dupe of: Can we test Face ID in simulator?
I want to know how to test when a user accepts the Face ID alert below that reads "Do you want to allow "app" to use Face ID" and then decides to disable Face ID for an app in the simulator.
This is not a dupe of: Can we test Face ID in simulator?
I want to know how to test when a user accepts the Face ID alert below that reads "Do you want to allow "app" to use Face ID" and then decides to disable Face ID for an app in the simulator.
When you run context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &authError)
it will return false and an authError as Optional<NSError>
:
Error Domain=com.apple.LocalAuthentication Code=-6 "User has denied
the use of biometry for this app." UserInfo=
{NSLocalizedDescription=User has denied the use of biometry for this app.}
Use error.code
for your tests, in this case it is -6, you can find more about LAError.Code codes in Apple docs
It is actually interesting topic: apparently, if a user did not give a permission for Face ID - only way to get it on a simulator is to reinstall the app. There is a discussion on Apple forum about it.