I want to know how I can call the iOS to show the alert pop up from apple to give the app access to Face ID/ Touch ID , when the user disable them from settings of the app. I know that this is put in info plist, but when I disable them from settings, it is not showing the ask again:
Asked
Active
Viewed 2,094 times
3 Answers
1
If Face ID is turned off in the settings, it must be redirected to the settings to turn it back on.

Mahmut Enes Çetin
- 131
- 4
0
As @Paulw11 mentioned, you only get to ask once. If the user denies access, the best you can do is ask them with an alert if they want to go to Settings to allow biometrics. Code would be something like this:
let alertController = UIAlertController (title: "Title", message: "Go to Settings?", preferredStyle: .alert)
let settingsAction = UIAlertAction(title: "Settings", style: .default) { (_) -> Void in
guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {
return
}
if UIApplication.shared.canOpenURL(settingsUrl) {
UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
print("Settings opened: \(success)") // Prints true
})
}
}
alertController.addAction(settingsAction)
let cancelAction = UIAlertAction(title: "Cancel", style: .default, handler: nil)
alertController.addAction(cancelAction)
present(alertController, animated: true, completion: nil)
As seen on this answer.
Have in mind that this will take the user from the app, but so far there is no other way of doing it.

Marina Aguilar
- 1,151
- 9
- 26
-1
You need to check wether device can authenticate by biometrics or not.
Let's do this right before you call your function to authenticate.
func canAuthenByBioMetrics() -> Bool {
let context = LAContext()
var authError: NSError?
if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &authError) {
return true
} else {
return false
}
}
Show your code will be like:
if self.canAuthenByBioMetrics() {
// Do you authentication
} else {
// Ask user for enable permission or setup biometric if needed
}

jacob
- 1,024
- 9
- 14