Import LocalAuthentification.framework file in iOS 7.1

You are having problems using LocalAuthentication and support for iOS 7.0

when i try

import LocalAuthentication 

I get a crash if the target iOS version is less than 8.0.

I tried to mark LocalAuthentication.framework as optional in the build steps and check the availability of the class by calling:

 var isTouchIDSupported: Bool { if let contextClass: AnyClass = NSClassFromString("LAContext") { return LAContext().canEvaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics, error: nil) } return false } 

it does not crash if I comment out the LAContext () line, for example:

 var isTouchIDSupported: Bool { if let contextClass: AnyClass = NSClassFromString("LAContext") { //return LAContext().canEvaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics, error: nil) } return false 

}

it crashes in the first seconds when the application starts if I access any of the LA classes (e.g. LAContext) anywhere in my code. What am I doing wrong here?

Console log for this failure:

 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 
+6
source share
4 answers

Local authentication is available in iOS 8.0. [ iOS Framework ]

To avoid a crash in iOS 7, go to “Project Goals” → “Form Phases” → “Linking Binary Files to Libraries” → set the LocalAuthentication.framework parameter to “Optional”

+1
source

This seems to be a bug in the simulator. Do not iPhone 5s (7.1). If you use iPhone 5 (7.1) and mark LocalAuthenification.framework as Optional , it works. ( Link Framework automatically to NO )

Same issue for iPad Air (7.1), but you can use the Resizable iPad / iPhone option, which works.

+4
source

First, I designated LocalAuthentification.framework as optionally changed "Link frame automatically" to NO, then a simple check against the access class in the code:

 - (BOOL)isTouchIDSupported { if (NSClassFromString(@"LAContext")) { return [self.context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil]; } return false; } 

Works great for me, hope someone help

+1
source

Try conditionally importing the LocalAuthentication infrastructure and all associated code with preprocessor directives. Then you can run iOS 7.x simulators and devices through Xcode.

+1
source

Source: https://habr.com/ru/post/976870/


All Articles