This is another strange issue on iOS 16, and one among the many woes that cause autoRotation problems on the platform. At the app startup time, there is a mismatch between -[UIViewController interfaceOrientation] (now deprecated), -[UIViewController supportedInterfaceOrientations] (which returns .landscapeRight), and -[windowScene interfaceOrientation].
public var windowOrientation: UIInterfaceOrientation {
return view.window?.windowScene?.interfaceOrientation ?? .unknown
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
layoutInterfaceForOrientation(windowOrientation)
}
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return .landscapeRight
Putting a breakpoint in viewDidLayoutSubviews reveals that windowOrientation is portrait while interfaceOrientation is .landscapeRight.
Is there anyway this can be fixed or any workaround possible?