There's a LA service in my app that uses TouchID pretty much as usual. The problem is that I want to change what is written on the alert that shows up when touchId authentication is prompted. First it shows what I declare in reason string, than if auth fails, it only changes title to 'Repeat', but body stays the same.
Is there any chance to change the alert's body for a different message when auth fails? I tried changing reason string but no effect.
This project is created using Xamarin, but Objective-C/Swift code is also acceptable. Thanks in advance!
UPD: here's my code:
if (context.CanEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, out authError))
{
var myReason = new NSString("Use your finger to authenticate");
replyHandler = new LAContextReplyHandler((success, error) =>
{
InvokeOnMainThread(() =>
{
if (success)
{
Login();
}
else
{
myReason = new NSString("Nope try again");
switch ((long)error.Code)
{
case (long)LAStatus.TouchIDLockout: // 5 times wrong, TouchID is locked system-wide
{
var alert = new UIAlertView("Sorry", "Exceeded and blocked message", null, "OK");
alert.Show();
touchIdButton.Hidden = true;
}
break;
case (long)LAStatus.AuthenticationFailed: // 3 times wrong
{
var alert = new UIAlertView("Sorry", "Exceeded message", null, "OK");
alert.Show();
touchIdButton.Hidden = true;
}
break;
case (long)LAStatus.UserFallback: //Enter Passcode
//no UserFallback for now
break;
}
}
});
});
context.EvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, myReason, replyHandler);