I see dozens of crashes in fabric
Fatal Exception: NSInvalidArgumentException
-[LAContext biometryType]: unrecognized selector sent to instance 0x1c066aa00
And it's strange because I do call biometryType on LAContext only for iOS 11+.
The code:
private static var biometryType: BiometryType? {
let context = LAContext()
guard context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil),
context.evaluatedPolicyDomainState == BiometryManager.savedPolicyDomainState else { return nil }
if #available(iOS 11.0, *) {
switch context.biometryType {
case .typeFaceID: return .typeFaceID
case .typeTouchID: return .typeTouchID
case .none: return nil
}
}
return .typeTouchID
}
Any suggestions?
The only clue I have is that all crashes related to 11.0.0. So maybe Apple added biometryType not in 11.0.0 but a bit later.
Links:
https://developer.apple.com/documentation/localauthentication/lacontext/2867583-biometrytype
http://www.codeprocedures.com/question/nsinvalidargumentexception-unrecognized-selector-sent-to-instance-on-specific-phone-with-ios-11/
This works as well:
if #available(iOS 11.0.1, *) {...}
The iPhone X first release was on 11.0.1
From crash reporting, this definitely works.
As @stonesam92 said, it is probably a bug in ios 11.0.0. The below code safeguards me against the crash.
if #available(iOS 11.0, *), authenticationContext.responds(to: #selector(getter: LAContext.biometryType))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With