Try this code, which is more or less how Apple put it on their website. My old code (from Paul Hudson), which is still working perfectly fine on all pre-18 versions, did not work anymore, neither on-device nor in the simulator.
func authenticate (completion: @escaping (Bool) -> Void) -> Void {
let context = LAContext()
Task {
do {
try await context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: "Please authenticate to use the app.")
completion(true)
}
catch {
completion(false)
}
}
}
Topic:
Privacy & Security
SubTopic:
General
Tags: