I'm having the same problem. How do I fix this?
Post
Replies
Boosts
Views
Activity
I am using LAContext.
if let user = Auth.auth().currentUser {
let context = LAContext()
var error: NSError?
guard context.canEvaluatePolicy(.deviceOwnerAuthentication, error: &error) else {
print(error?.localizedDescription ?? "Can't evaluate policy")
return
}
Task {
do {
try await context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: "Use \(context.biometryType == .faceID ? "Face ID":"Touch ID") to log into your account")
viewModel.getUser(docId: user.uid) { result in
switch result {
case .success(let userProfile):
habitat.user = userProfile
habitat.appScene = .home
case .failure(let error):
viewModel.authError = error
viewModel.isError = true
}
}
} catch let error {
print(error.localizedDescription)
}
}
}