1

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

Krunal
  • 77,632
  • 48
  • 245
  • 261

1 Answers1

1

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

Krunal
  • 77,632
  • 48
  • 245
  • 261
  • 3
    How do we code this so it works with both Xcode 9.1 *and* Xcode 9.2? There is no #if for Xcode version. For now I am creating my own value with `let faceIDRawValue = 2` and using that. – Reid Ellis Dec 07 '17 at 19:23