How do I use TouchID in landscape mode?

828 Views Asked by At

I want to use TouchID in my app which is in landscape mode only. Everything is ok, but the authentication alert is shown only in portrait mode. what should I do?

Here is My code:

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

There are 1 best solutions below

3
On

The App Store app does rotate the Touch ID alert but it seems to be a hack.

As you rotate the device (I tried using a 6+), you see the grey alpha mask rotate along with the Touch ID alert. They may be applying a transform on the view but I have not figured out how to get to that view yet.

The XCode UI inspector does not show the Touch ID dialog in your view hierarchy at runtime. Understandably as it runs in a separate process.

Edit: I reported it to Apple along with a test app. RadarWeb bug ID 19893424