我在布料上看到了几十次崩溃
Fatal Exception: NSInvalidArgumentException
-[LAContext biometryType]: unrecognized selector sent to instance 0x1c066aa00这很奇怪,因为我只为iOS 11+调用LAContext上的biometryType。
代码:
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
}

有什么建议吗?
我唯一的线索是所有的崩溃都与11.0.0有关。因此,也许苹果在11.0.0中没有添加biometryType,而是晚了一点。
链接:
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/
发布于 2017-12-07 00:33:57
正如@stonesam92 am92所说,这可能是iOS11.0.0中的一个错误。下面的代码可以保护我免受崩溃的影响。
if #available(iOS 11.0, *), authenticationContext.responds(to: #selector(getter: LAContext.biometryType))发布于 2017-12-14 09:54:05
这也是可行的:
if #available(iOS 11.0.1, *) {...}iPhone X的第一个发行版是11.0.1
从崩溃报告来看,这绝对是有效的。
发布于 2017-12-05 01:41:39
这不是一个很好的解决方案,但这似乎是iOS 11.0中的一个错误。
我已经看到了许多关于这个崩溃的报告,当用户升级到更新版本的iOS时,所有的问题都已经解决了。
https://stackoverflow.com/questions/47588884
复制相似问题