It seems that the iPhoneX portraitUpsideDown screen orientation does not work in the simulator.
For all other devices it does work.
Update: Still not working with Xcode Version 9.1 beta (9B37)
It seems that the iPhoneX portraitUpsideDown screen orientation does not work in the simulator.
For all other devices it does work.
Update: Still not working with Xcode Version 9.1 beta (9B37)
I haven't seen any radars filed about this. Please file a radar at http://bugreport.apple.com, and reference the radar ID here.
It really is a problem and others also have observed this, e.g.
https://forums.developer.apple.com/thread/87888?q=portrait%20upside%20down
A solution for me is to temporarily remove the support for portrait upside down orientation on iPhoneX only.
Still not working with Xcode Version 9.1 beta 2 build 9B46!!
Again only for iPhoneX, all other devices including iPads are ok.
Will try to create a small project to prove this error for iPhoneX.
Do you have a small project for me which shows that portraitUpsideDown functions correctly in the simulator for iPhone X?
Created a super simple app with 1 view controller and 1 view.
It clearly shows that iPhoneX is not working with the portraitUpsideDown screen orientation.
The iOS 11 bug is that the frame of the view is not updated after a change in screen orientation to portraitUpsideDown.
For all other devices the frame of the view is correctly updated for this case.
Please fix.
Submitted a bug report and included the small sample project.
The assigned id = 34907554
Hope this helps.
When I first saw this fact, I tought it is by design, because of the non-symetric up and down part of the screen. It may turn very difficult to adjust UI display upside-down.
It is by design. We're getting documentation updated in a future release to reflect that.
So apps running on iPhoneX will not receive a screen rotation notification if the new orientation = PortraitUpsideDown?
Also [[UIDevice currentDevice] orientation] will never return UIDeviceOrientationPortraitUpsideDown?
In the current release this is the case, even if UIInterfaceOrientationMaskAllButUpsideDown is returned in the supportedInterfaceOrientations function of UIVIewController (in the iPhoneX case).
From a functional point of view, some users might be disappointed that this orientation is not supported. For some of my apps it is used to have the audio cable connection at the top of the device. The alternative, wireless audio, is not always usable because of latency issues.
This is very unfortunate for apps that use hardware docked to the lighting port (for example thermal cameras; light-metering hardware; external microphones). In practical use many of these apps work best with the docked hardware atop the iPhone, e.g., with the iPhone in upside-down portrait orientation. Light-metering apps especially (Lumu Light Meter; Cine Meter II) work best with the sensor elevated, not shadowed by the iPhone or the hand and arm holding it. Using light meters with the sensor at the bottom of the device is awkward at best.
Please consider re-supporting upside-down portrait mode in a future build. I realize that means that iPhone-X-aware apps will then need to support three different screen sizes (as when upside-down, the usable height will be decreased since status data can't be tucked in beside the notch), but it'd be worth the pain for the gain in usability for hardware-based apps.
> So apps running on iPhoneX will not receive a screen rotation notification if the new orientation = PortraitUpsideDown?
Sadly no, at least not according to the simulator. You still get the notification, even though "the rest of the UI" doesn't rotate from its previous orientation.
On other iOS 8+ iPhones, the mainScreen bounds will be reported in the correct orientation, e.g., height > width when orientation is UIInterfaceOrientationPortraitUpsideDown. On the iPhone X simulator, though, rotating from landscape to upside-down shows width > height. I'm using that to catch iPhone X upside-downness and not update my UI for the orientation:
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
NSLog(@"screen size height %f, width %f", screenSize.height, screenSize.width);
// check for iPhone X: is orientation upside down, but width >= 667 (not 414, 375, or less as it should be)?
// (all 667+ x 375+ devices run iOS 8 or higher, so the reported dims are always rotated as needed)
if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown &&
screenSize.width >= 667) {
NSLog(@"Looks like iPhone X; ignoring rotation.");
return;
}
(The comment on line 5 is in reference to pre-IOS 8 devices, which always reported portrait-orientation bounds regardless. I can't just check for height > width unless I test iOS version as well—I support back to iOS 6 in the affected apps—so it's easier to test for an iPhone-6-or-larger too-wide width value, since all such large-screen iPhones run iOS 8 or later. I'm building the release version with XCode 7.3, so it isn't iPhone X-aware and the UI stays within the safe area, to iOS tells it it has an iPhone 6/7/8 area to work with, but if you're using XCode 9 and the latest SDK I think the same code should work fine.. If this app were universal I'd have to watch out for iPad sizes, too; that complication is left as an exercise for the reader)
This seems to work in the sim, even if I switch directly from right-side-up to upside-down. Your mileage may vary, and the actual device may not behave this way, though without an actual device one can't say for sure.
If you don't need upside-down, of course, it's easier just to disallow it throughout your app. I need to support headphone-jack hardware (remember headphone jacks?) on older devices, and that hardware wants to be above the device instead of below it, so I still support upside-down when the hardware and firmware allow.
Just received a message from Apple that they consider bug ID# 34907554 closed, because the iPhone X will not support the portrait upside-down orientation.
Hope this will be clearly communicated to the users, so that the apps will not be blamed.
Thank you for your detailed answer. Could update all my apps according to your line of thinking.
I disovered this iPhoneX limitation very recently. And that's not only for simulator but IRL as well ?
I understand it may a bit tricky to conciliate the notch with the bar at the bottom, but there were probably much more complex issues solved, and…
That ends up with a surpirsing and bad user experience.
Here is a use case:
- you have someone in front of you
- you want to show him the phone
- used just to bend the phone to him to get it the right way
- no nome possible, need now to turn the whole phone
- if ever it connected to a cable for whatever reason, it is really unpractical.
Isn't there a way to get the bar split in 2 parts, along the notch in this situation ? That would be much better than getting the view upside down or keeping in landscape with the bar at right or left !
Maybe Apple doesn't want it for its own software, but that should be left available for apps.