【问题标题】:How do I use TouchID in landscape mode?如何在横向模式下使用 TouchID?
【发布时间】:2014-11-18 08:03:19
【问题描述】:

我想在仅处于横向模式的应用中使用 TouchID。一切正常,但身份验证警报仅以纵向模式显示。我该怎么办?

这是我的代码:

LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
NSString *myLocalizedReasonString = [[NSString alloc] initWithUTF8String: title];

if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
         [myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
                   localizedReason:myLocalizedReasonString
                             reply:^(BOOL success, NSError *error) {
                                 if (success) {
                                     // User authenticated successfully, take appropriate action
                                     NSLog(@"Authenticated using Touch ID.");
                                     //do something
                                 } else {
                                     // User did not authenticate successfully, look at error and take appropriate action
                                     if (authError.code == kLAErrorUserFallback) {
                                         NSLog(@"User tapped Enter Password");
                                     } else if (authError.code == kLAErrorUserCancel) {
                                         NSLog(@"User tapped Cancel");
                                     } else {
                                         NSLog(@"Authenticated failed.");
                                     }
                                 }
                             }];
} else {
    // Could not evaluate policy; look at authError and present an appropriate message to user
    NSLog(@"Touch ID is not available: %@", authError);
}

【问题讨论】:

    标签: ios8 landscape fingerprint


    【解决方案1】:

    App Store 应用确实会旋转 Touch ID 警报,但它似乎是一个 hack。

    当您旋转设备时(我尝试使用 6+),您会看到灰色 alpha 蒙版与 Touch ID 警报一起旋转。他们可能正在对视图应用变换,但我还没有弄清楚如何到达该视图。

    XCode UI 检查器在运行时不会在视图层次结构中显示 Touch ID 对话框。可以理解,因为它在单独的进程中运行。

    编辑:我将它与一个测试应用程序一起报告给了 Apple。 RadarWeb 错误 ID 19893424

    【讨论】:

    • Martin-Gilles Lavoie:这个错误修复了吗?
    • 还没有机会使用 iOS 9b,因为我们即将发布,而且法律尚未批准 iOS9b 许可证。此外,通常,Apple 仅在发布后更新radarweb。
    • 我想现在已经很明显了,但我要公开声明,从 iOS 9.1 开始,Apple 还没有解决这个问题。
    猜你喜欢
    • 2023-02-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多