I am creating a new app, and I want to put in a hidden folder. Which is accessed by Face ID/Touch ID. I have implemented the code, but when I run the app, and use Face ID. The app crashes with the error 'NSInternalInconsistencyException'
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.
In my Viewcontroller, I have set up the view as:
override func viewDidLoad() {
super.viewDidLoad()
let cornerRadius : CGFloat = 10.0
containerView.layer.cornerRadius = cornerRadius
tableView.clipsToBounds = true
tableView.layer.cornerRadius = 10.0
// 1
let context = LAContext()
var error: NSError?
// 2
// check if Touch ID is available
if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
// 3
let reason = "Authenticate with Biometrics"
context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reason, reply: {(success, error) in
// 4
if success {
self.showAlertController("Biometrics Authentication Succeeded")
} else {
self.showAlertController("Biometrics Authentication Failed")
}
})
}
// 5
else {
showAlertController("Biometrics not available")
}
}
I want Face ID/Touch ID to work as expected and not crash if verified.