iosuialertviewlacontext

How to remove Enter Password and Cancel button from Touch ID alert view


I got stuck that don't want Enter Password in the Alert of thumb impression

[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:NSLocalizedString(@"UNLOCK_ACCESS_TO_LOCKED_FEATURE", nil) reply:
         ^(BOOL success, NSError *authenticationError)
         {
             if (success)
             {

                 msg =[NSString stringWithFormat:NSLocalizedString(@"EVALUATE_POLICY_SUCCESS", nil)];
             }
             else
             {
                 msg = [NSString stringWithFormat:NSLocalizedString(@"EVALUATE_POLICY_WITH_ERROR", nil), authenticationError.localizedDescription];
             }
         }];
     }

Solution

  • To hide the button "Enter password", you need to set localizedFallbackTitle to an empty string.

    //...
    LAContext *context = [[LAContext alloc] init];
    
    // Hide "Enter Password" button
    context.localizedFallbackTitle = @"";
    
    // show the authentication UI
    //...
    

    About the "Cancel" button I don't think that it is possible to remove it.

    Hope that it will be helpful.