rushisangani / BiometricAuthentication

Use Apple FaceID or TouchID authentication in your app using BiometricAuthentication.
MIT License
831 stars 110 forks source link

Binary operator '==' cannot be applied to operands of type 'LABiometryType' and '_' #8

Closed d0hnj0e closed 6 years ago

d0hnj0e commented 6 years ago

public func faceIDAvailable() -> Bool { if #available(iOS 11.0, *) { let context = LAContext() return (context.canEvaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, error: nil) && context.biometryType == .typeFaceID) } return false }

returns an error

d0hnj0e commented 6 years ago

fixed by:

public func faceIDAvailable() -> Bool { if #available(iOS 11.0, *) { let context = LAContext() return (context.canEvaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, error: nil) && context.biometryType == .faceID) // changed } return false }

rushisangani commented 6 years ago

It's working on Xcode 9.1, iOS 11, Swift 3.2 and Swift 4.0. Could you please mention Xcode, iOS and Swift version that you're using.

zjfjack commented 6 years ago

He was using Xcode 9.2, looks like some keywords changed. Fixed this issue through(.typeFaceID -> .faceID, .typeTouchID -> .touchID)