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
This seems to be a bug in the simulator. Do not choose iPhone 5s (7.1). If you use iPhone 5 (7.1) and mark the LocalAuthentification.framework as Optional it works. (Link Framework Automatically to NO as well)
Same problem for iPad Air (7.1), but you can use the Resizable iPad/iPhone option, which works.
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'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With