【问题标题】:Unable to localize Face Id popup for non-matching face无法本地化不匹配人脸的人脸 ID 弹出窗口
【发布时间】:2018-06-20 05:41:10
【问题描述】:

Face Id 似乎忽略了localizedFallbackTitlelocalizedReason。但是localizedCancelTitle 工作正常。有谁知道如何让它工作?

我的代码:

LAContext *context = [[LAContext alloc] init];
if ([context respondsToSelector:@selector(setLocalizedCancelTitle:)]) {
    context.localizedCancelTitle = [Language get:CANCEL alter:nil];
}

if ([context respondsToSelector:@selector(setLocalizedFallbackTitle:)])
{
    context.localizedFallbackTitle = [Language get:TRY_AGAIN alter:nil];
}

NSError *error = nil;
if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthentication error:&error]) {
   [context evaluatePolicy:LAPolicyDeviceOwnerAuthentication
   localizedReason:[Language get:AUTHRNTICATE_USING_YOUR_FACE alter:nil] reply:^(BOOL success, NSError *error) {
   //code
}

截图:

如果可能,我想本地化此弹出窗口中的所有内容。

注意: 附件截图是在模拟器上拍摄的。我也检查过 它在真实设备上,但结果是一样的。此外,对于 Touch id,它工作正常。

【问题讨论】:

    标签: ios objective-c face-id


    【解决方案1】:

    根据这个Post,在身份验证过程之间没有用于更改原因的API。

    本地化原因

    应用程序提供的请求身份验证的原因,显示在 > 呈现给用户的身份验证对话框中。

    您可以使用BiometricAuthentication 来显示您的信息。

    BioMetricAuthenticator.authenticateWithBioMetrics(reason: "", success: {
    
        // authentication successful
    
    }, failure: { [weak self] (error) in
    
        // do nothing on canceled
        if error == .canceledByUser || error == .canceledBySystem {
            return
        }
        
        // device does not support biometric (face id or touch id) authentication
        else if error == .biometryNotAvailable {
            self?.showErrorAlert(message: error.message())
        }
    
        // show alternatives on fallback button clicked
        else if error == .fallback {
    
            // here we're entering username and password
            self?.txtUsername.becomeFirstResponder()
        }
    
        // No biometry enrolled in this device, ask user to register fingerprint or face
        else if error == .biometryNotEnrolled {
            self?.showGotoSettingsAlert(message: error.message())
        }
    
        // Biometry is locked out now, because there were too many failed attempts.
        // Need to enter device passcode to unlock.
        else if error == .biometryLockedout {
            // show passcode authentication
        }
    
        // show error on authentication failed
        else {
            self?.showErrorAlert(message: error.message())
        }
    })
    

    【讨论】:

      猜你喜欢
      • 2011-12-14
      • 2019-07-11
      • 2021-03-16
      • 2018-07-30
      • 2018-06-19
      • 2013-08-22
      • 2011-06-12
      • 2019-11-18
      • 2019-02-27
      相关资源
      最近更新 更多