16

I need for my app to login using TouchId, but I don't want the user to select or fallback into Password option. In other words I'd like to hide the 'Enter Password' label in the figure below. Thanks.

TouchId with Passcode option

Legolas
  • 805
  • 1
  • 11
  • 24

3 Answers3

26

The answer is "Yes".You can hide the "Enter password"...

Try the following code snippet,

var LocalAuthentication = LAContext()

LocalAuthentication.localizedFallbackTitle = ""  // Add this line 

if LocalAuthentication.canEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, error: &errorMsg){

Add this line before checking for the policy....

LocalAuthentication.localizedFallbackTitle = ""

Hope this might help you..

Legolas
  • 805
  • 1
  • 11
  • 24
4

As far as I know there is no way to hide the password option. Although you can use the device passcode as the fall back.

Please note that the terminology "Passcode" and "Password" refers to different thing in TouchID integration.

"Password" is used for LocalAuthentication approach for integrating TouchID and refering to the applications password as fallback method.

While "Passcode" is referring to the passcode to unlock the device and authenticate purchase in app store.To use the method, you have to store some information to the device's keychain and retrieve it via Touch ID authentication.

See more about these two approaches here

iOS 9 Edit

Based on this answer, iOS 9 provide a new option to hide the passcode option.

For iOS 9, two new policies have been added that do not fallback to passcode. These policies are kSecAccessControlTouchIDAny and kSecAccessControlTouchIDCurrentSet

Community
  • 1
  • 1
Summer
  • 488
  • 4
  • 14
2

Per documentation from LocalAuthentication.LAContext:

/// Fallback button title.
/// @discussion Allows fallback button title customization. A default title "Enter Password" is used when
///             this property is left nil. If set to empty string, the button will be hidden.
open var localizedFallbackTitle: String?
Oleg Novosad
  • 2,261
  • 1
  • 27
  • 28