Search code examples
iostouch-idface-idlocalauthenticationxcode9.2

iOS 11.2 - Local Authentication - Type 'LABiometryType' has no member 'typeFaceID'


I've added face-id support/code for integration in my app, which was working fine with Xcode 9.1 & iOS 11.1.

But the same is showing an error with iOS 11.2 and Swift 4.0 in Xcode 9.2 Beta 2

Code I've in my app:

if #available(iOS 11.0, *) {
                if (laContext.biometryType == LABiometryType.typeFaceID) {
                    localizedReason = "Unlock using Face ID"
                    print("FaceId support")
                } else if (laContext.biometryType == LABiometryType.typeTouchID) {
                    localizedReason = "Unlock using Touch ID"
                    print("TouchId support")
                } else {
                    print("No Biometric support")
                }
 } else {
     // Fallback on earlier versions
}

Error messages are:

Type 'LABiometryType' has no member 'typeFaceID'

Type 'LABiometryType' has no member 'typeTouchID'

enter image description here


Solution

  • I found solution from Apple document: LABiometryType

    LocalAuthentication ► LocalAuthentication Enumerations ► LABiometryType

    LABiometryType
    It is an enum type of constant which support types of biometric authentication.

    Apple has changed title/name of constant elements from iOS 11+.

    • typeFaceID ▶ faceID
    • typeTouchID ▶ touchID

    and one more new enum element is added: .none which is a part of beta version at this time.

    enter image description here