如何在横屏模式下使用TouchID?

4

我希望在我的应用中使用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);
}
1个回答

5
App Store应用确实可以旋转Touch ID警报,但似乎这是一种黑客方法。
当您旋转设备时(我尝试使用6+),您会看到灰色alpha蒙版随着Touch ID警报一起旋转。他们可能正在视图上应用某种变换,但我还没有弄清如何进入该视图。
XCode UI检查器在运行时不显示Touch ID对话框在您的视图层次结构中。可以理解为它在单独的进程中运行。
编辑:我向苹果报告了这个问题,并提交了一个测试应用程序。RadarWeb Bug ID 19893424

Martin-Gilles Lavoie:这个错误修复了吗? - Siddharthan Asokan
由于我们即将发布,法律部门尚未批准iOS9b许可证,因此我还没有使用过iOS 9b。另外,通常情况下,苹果只会在发布后更新radarweb。 - Martin-Gilles Lavoie
我想现在很明显了,但我要记录下来说,在iOS 9.1版本中,这仍然没有被苹果修复。 - Martin-Gilles Lavoie

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接