I'm integrating Permissions screen, in iOS App, where I have visual information about what security options are turned on or turned off, and I want to check whether the user has disabled Face ID for my app in the system settings to show them exact information, and if they will switch it from App Settings, after return back to update UI.
The goal is to silently detect this change without prompting the user for authentication.
I'm aware that I can use the LocalAuthentication framework to attempt to authenticate with Face ID, and handle the success or failure of that attempt. However, this approach requires me to prompt the user for authentication, which I want to avoid.
Here's the code snippet I've been using to authenticate with Face ID:
private func isFaceIDPolicyAvailable() -> Result<Bool, LAError> {
var error: NSError?
let permissions = context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error)
if permissions {
return .success(true)
} else {
guard let error = error else {
return .failure(LAError(.biometryNotAvailable))
}
return .failure(LAError(_nsError: error))
}
}
While this code allows me to request Face ID authentication, it doesn't allow me to silently check the app-specific Face ID permission.
Is there a way to determine whether the user has specifically disabled Face ID for my app in the system settings without showing a prompt to the user? Any insights or alternative approaches would be greatly appreciated.