【发布时间】:2014-12-13 02:55:59
【问题描述】:
LocalAuthentication 使用有问题,支持 iOS 7.0
当我尝试时
import LocalAuthentication
如果目标 iOS 版本低于 8.0,我会崩溃。
我尝试在构建阶段将 LocalAuthentication.framework 标记为 可选 并通过调用 检查类可用性:
var isTouchIDSupported: Bool {
if let contextClass: AnyClass = NSClassFromString("LAContext") {
return LAContext().canEvaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics, error: nil)
}
return false
}
如果我评论 LAContext() 字符串,它不会崩溃:
var isTouchIDSupported: Bool {
if let contextClass: AnyClass = NSClassFromString("LAContext") {
//return LAContext().canEvaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics, error: nil)
}
return false
}
如果我在代码的任何位置访问任何 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
【问题讨论】:
-
你在使用 Swift 吗?然后你可能必须创建一个桥头文件并将其导入那里。
-
所选答案实际上并未解决您的问题。您能否发布包含解决方案的实际答案。我也遇到了同样的问题。
-
我遇到了同样的问题,将“自动链接框架”更改为否。它没有解决问题。你能解决它吗?
标签: ios ios7 swift xcode6 touch-id