Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LAContext change UIAlertController button title

I've incorporated TouchID into my app with LAContext, like so:

enter image description here

However, I'm wanting to change the name of the button title from "Enter Password" to enter "Enter Security Code" (or something like that), like this:

enter image description here

How would I go about changing that button title?

Here's the LAContext documentation and here's my code:

var touchIDContext = LAContext()

if touchIDContext.canEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, error: &msgError) {
   touchIDContext.evaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics, localizedReason: touchIDMessage) {
        (success: Bool, error: NSError!) -> Void in

        if success {
            println("Success")
        } else {
            println("Error: \(error)")
        }
    }
}
like image 562
Cody Winton Avatar asked Jan 22 '15 17:01

Cody Winton


1 Answers

Set the localizedFallbackTitle property:

Objective-C:

LAContext *context = [[LAContext alloc] init];
context.localizedFallbackTitle = @"YOUR TEXT HERE";

Swift:

var touchIDContext = LAContext()
context.localizedFallbackTitle = "YOUR TEXT HERE"
like image 169
Paul Cezanne Avatar answered Nov 04 '22 22:11

Paul Cezanne