我看到织物上发生了数十次撞击事故
Fatal Exception: NSInvalidArgumentException
-[LAContext biometryType]: unrecognized selector sent to instance 0x1c066aa00
Run Code Online (Sandbox Code Playgroud)
这很奇怪,因为我只在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
}
Run Code Online (Sandbox Code Playgroud)
有什么建议?
我唯一的线索是所有崩溃都与11.0.0有关.因此,Apple可能在11.0.0中添加了biometryType,但稍后.
链接:
https://developer.apple.com/documentation/localauthentication/lacontext/2867583-biometrytype
Son*_* VR 15
正如@ stonesam92所说,这可能是ios 11.0.0中的一个错误.以下代码保护我免受崩溃.
if #available(iOS 11.0, *), authenticationContext.responds(to: #selector(getter: LAContext.biometryType))
Run Code Online (Sandbox Code Playgroud)
Dan*_*iel 10
这也有效:
if #available(iOS 11.0.1, *) {...}
Run Code Online (Sandbox Code Playgroud)
iPhone X首次发布于11.0.1
从崩溃报告来看,这绝对有效.
| 归档时间: |
|
| 查看次数: |
1802 次 |
| 最近记录: |