在iOS 7.1上导入LocalAuthentification.framework崩溃 [英] Import LocalAuthentification.framework crashes on iOS 7.1
问题描述
使用LocalAuthentication时出现问题并支持iOS 7.0
当我尝试
<$ p时$ p>
import LocalAuthentication
如果目标iOS版本是小于8.0。
我尝试在构建阶段将 LocalAuthentication.framework 标记为可选,并检查课程可用性通过调用:
var isTouchIDSupported:Bool {
if let contextClass:AnyClass = NSClassFromString(LAContext ){
返回LAContext()。canEvaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics,error:nil)
}
返回false
}
如果我评论LAContext()字符串,它不会崩溃:
var isTouchIDSupported:Bool {
如果让contextClass:AnyClass = NSClassFromString(LAContext){
//返回LAContext()。canEvaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics,error:nil)
}
返回false
}
如果我访问该应用程序,它会在应用程序启动的第一秒崩溃任何LA类(例如LAContext)在我的代码的任何地方。我在这里做错了什么?
这次崩溃的控制台日志:
dyld:未找到符号:_objc_isAuto
引用自:/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
预期于:/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
LocalAuthentication.framework可从iOS 8.0获得。 [ iOS Frameworks ]
为了避免iOS 7中的崩溃,请转到项目目标 - >构建阶段 - >链接二进制文件库 - >将LocalAuthentication.framework的状态设置为可选 '
Have a problem with usage of LocalAuthentication and support iOS 7.0
when I'm trying to
import LocalAuthentication
I'm getting crash if target iOS version is less than 8.0.
I tried to mark LocalAuthentication.framework as optional in the build phases and check class availability by calling:
var isTouchIDSupported: Bool {
if let contextClass: AnyClass = NSClassFromString("LAContext") {
return LAContext().canEvaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics, error: nil)
}
return false
}
it do not crash if I comment LAContext() string like:
var isTouchIDSupported: Bool {
if let contextClass: AnyClass = NSClassFromString("LAContext") {
//return LAContext().canEvaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics, error: nil)
}
return false
}
it crashes at the first seconds the app is launches if I accessing the any of LA class (LAContext for instance) in any place of my code. What I'm doing wrong here?
Console log for this crash:
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
LocalAuthentication.framework is available from iOS 8.0. [ iOS Frameworks ]
To avoid the crash in iOS 7, go to 'Project Targets' -> 'Build Phases' -> 'Link Binary with Libraries' -> set LocalAuthentication.framework's status to 'Optional'
这篇关于在iOS 7.1上导入LocalAuthentification.framework崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!