iiF*_*man 6 ios ios7 touch-id swift xcode6
使用LocalAuthentication时遇到问题并支持iOS 7.0
当我想要的时候
import LocalAuthentication
Run Code Online (Sandbox Code Playgroud)
如果目标iOS版本低于8.0,我就会崩溃.
我尝试在构建阶段将LocalAuthentication.framework标记为可选,并通过调用以下方法检查类可用性:
var isTouchIDSupported: Bool {
if let contextClass: AnyClass = NSClassFromString("LAContext") {
return LAContext().canEvaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics, error: nil)
}
return false
}
Run Code Online (Sandbox Code Playgroud)
如果我评论LAContext()字符串,它不会崩溃:
var isTouchIDSupported: Bool {
if let contextClass: AnyClass = NSClassFromString("LAContext") {
//return LAContext().canEvaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics, error: nil)
}
return false
Run Code Online (Sandbox Code Playgroud)
}
如果我在代码的任何地方访问任何LA类(例如LAContext),它会在应用程序启动的第一秒崩溃.我在这里做错了什么?
此崩溃的控制台日志:
dyld: Symbol not found: _objc_isAuto
Referenced from: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/usr/lib/libobjc.A.dylib
in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2444 次 |
| 最近记录: |