Currently, I have the following code in place.
if localAuthenticationContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &authError) {
localAuthenticationContext.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reasonString) { success, evaluateError in
if success {
self.performSegue(withIdentifier: "settingChange", sender: self) //TODO: User authenticated successfully, take appropriate action
The code performs a segue, to another view Controller if the touch id is correctly authenticated, however when I try out the code I get this error:
I have tried the code without using the TouchID, and it works fine but I don't know why it produces the error upon the TouchID use. Can someone help?
There may be an issue with performSegue operation. All UI changes related operations must be performed in main queue. Use DispatchQueue
with main.
Try this and see (Note: I've solution in Swift 4):
if success {
DispatchQueue.main.async(execute: {
self.performSegue(withIdentifier: "settingChange", sender: self)
})
}