iOS 16 introduced a new API for forcing orientation changes, which implies using the requestGeometryUpdate(_:errorHandler:)
.
It seems that it's not working as expected when using a full screen modal.
For example, let's say we have an app that locks the orientation in portrait mode except for a modally presented controller, a parent controller A and a modal controller B :
- A is displayed
- We put the device in landscape mode - A stays in portrait mode
- B is opened modally fullscreen from A
- B is displayed in landscape
- B has a button to go back to portrait mode using the
requestGeometryUpdate(_:errorHandler:)
- B is dismissed through a button
- A ends up in landscape
In the app delegate, we used supportedInterfaceOrientationsFor
to force the app in portait mode except for the controller B.
We tried to call setNeedsUpdateOfSupportedInterfaceOrientations
every time we call requestGeometryUpdate(_:errorHandler:)
.
We also tried to call it on the viewWillAppear
from the controller A.
We finally tried to call requestGeometryUpdate(_:errorHandler:)
from the controller A's viewWillAppear
, without any luck as well.
Is this a bug in iOS 16 or are we missing something ? It seems to be working as expected when displaying the modal over the current context, but it's not what we want in this case.
I can provide an example project if needed.