Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import LocalAuthentification.framework crashes on iOS 7.1

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
like image 427
iiFreeman Avatar asked Oct 17 '14 13:10

iiFreeman


2 Answers

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.

like image 199
akw Avatar answered Nov 15 '22 07:11

akw


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'

like image 29
Asif Asif Avatar answered Nov 15 '22 08:11

Asif Asif