Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot rotate interface orientation to portrait upside down on iPhone X

We have an app which makes use of an accessory connected to the audio jack(or lightning port in iPhone7 or later).It needs to be run in certain orientations, depending on iOS device.

There are currently no issues setting device orientation in either simulator or actual device for any iPhone, except the iPhoneX simulator.

Current code for setting orientation:

- (BOOL)shouldAutorotate {
    return YES;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
    //device checks omitted
    return UIInterfaceOrientationMaskPortraitUpsideDown;
}

Target settings with orientations enabled

Stack trace:

TF uncaught exception reason : Supported orientations has no common orientation with the application, and [RootNavigationController shouldAutorotate] is returning YES
2017-10-05 09:35:02.692945+0200 [65045:74145368] *** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [RootNavigationController shouldAutorotate] is returning YES'

This is working on iPhone5, iPhone6, iPhone6+, iPhone7 and iPhone7+ devices and iPhone8 simulators. It doesn't seem to be an iOS11 issue either as my iPhone7 is currently running iOS11. The only device I'm currently having issues with is the iPhoneX simulator.

like image 478
CarlB26 Avatar asked Oct 05 '17 07:10

CarlB26


People also ask

Why won't my phone rotate upside down?

Turn on Auto rotate. You'll find this setting in the Quick Settings menu. If you see Auto rotate highlighted in blue, then auto rotate is turned on. If you don't see Auto rotate, but there's a Portrait icon instead, auto rotate is disabled.

Why is my portrait rotation not working?

Swipe up from the bottom edge of your screen to open Contol Center. Tap the Portrait Orientation Lock button to make sure that it's off. That's it.

Why is my screen orientation not changing?

If the Android screen rotation not working happens to you , or you're just not a fan of the feature, you can re-enable screen auto-rotate on your phone. Find and turn on the "Auto-rotate" tile in the quick-setting panel. You can also go to Settings > Display > Auto-rotate screen to turn it on.


1 Answers

It appears that the iPhone X will not support upside-down orientation; see https://forums.developer.apple.com/message/268015. An Apple staffer says, "It is by design. We're getting documentation updated in a future release to reflect that."

You still get the orientation change notification, at least in the sim, but as you found, Bad Things may happen if you act on it. In my case I don't get an exception, but my UI doesn't redraw properly.

I'm adding code to detect an upside-down iPhone X and prevent the UI redraw; it works in the sim, and we'll have to wait and see if it'll work on the real device (fortunately my use case for upside-down only involves a headphone-jack device, so loss of upside-down on iPhone X isn't a big deal for me).

The upshot is that those of us using lighting port Sensors That Want To Be On Top will not be able to offer iPhone X users the same usability as on "lesser" iPhones, at least not without some seriously tedious UI jiggery-pokery involving lots of affine transforms to rotate and/or flip elements to appear upside-down while still conforming to what the phone thinks it's doing. Sigh.

like image 62
Adam Wilt Avatar answered Oct 01 '22 21:10

Adam Wilt