Issue on screen orientation in iPhone 8 Plus and iPhone X

I have a Navigation View with a List in it. When I push one of the elements in the list I go to a view with a Player in it which can rotate and go full screen. If I run the app in a Iphone 12 Plus or others, every thing works as I spected but if I run it in an iPhone 8 Plus or iPhone X, when the device is rotated it sends the app to the previous screen but the video is still playing underneath.

I have tried it in real devices and simulators with the same result, all of them have the same iOS version and the same app version.

Code Block swift
DispatchQueue.main.async {
MyAppDelegate.shared.orientationLock = .landscape
UIDevice.current.setValue(UIInterfaceOrientation.portrait.rawValue, forKey: "orientation")
UINavigationController.attemptRotationToDeviceOrientation()
}
AppDelegate:
var orientationLock = UIInterfaceOrientationMask.portrait
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return orientationLock
}

I have also tried doing this without executing on the main thread (DispatchQueue.main.async {)

Where do you call lines 2 to 6 ?

Have you checked that presentation of ViewControllers is fullScreen and not Automatic ?
Hi, thanks for you reply..

I call these lines in the view's principal Stack .onAppear method, it is SwiftUI.

Have you checked that presentation of ViewControllers is fullScreen and not Automatic ?
I don't really know how to do this in SwiftUI, can you show me?

Thanks a lot.
Use the fullScreenCover modifier:
Code Block
.fullScreenCover(isPresented: $isPresented, content: FullScreenModalView.init)

See here:
https ://www.hackingwithswift. com/quick-start/swiftui/how-to-present-a-full-screen-modal-view-using-fullscreencover
Issue on screen orientation in iPhone 8 Plus and iPhone X
 
 
Q