Objective C App has wrong [UIScreen mainScreen].bounds value since iOS 16

Device: Physical iPhone X (16.0.2)

A legacy app (Objective C) of my client has worked just fine on iOS 15. On iOS 16 though, the app has suddenly 'shrunken in height'. The app opens as usual but on the top and bottom of the screen, there are black bars, as the app itself seems to be constrained to a certain size.

After some investigation, I found out that the device actually reports its Screen Height to be 480pt (iPhone X). Forcing the UIWindow to have a different size doesn't solve the issue, the app is still constrained to be the same wrong height. It seems the device 'actually believes' to be shorter than it is.

Since this behavior kind of resembles what happens when starting an iPhone app on an iPad (at least I remember seeing something like that some time ago), I was wondering whether or not this behavior is expected as of iOS 16?

If not, I would really appreciate some help here.

+[UIScreen mainScreen] is deprecated in iOS 16. Could you try accessing the screen property from the appropriate window scene (for example in a view controller, you access the screen it’s on via self.view.window.windowScene.screen).

If the problem still persists, are you able to reproduce this in a sample project?

I answered the question instead of responding to the comment by mistake, please delete this

The issue seems to originate from a layer above the WindowScene. I checked, and the value reported for self.view.window.windowScene.screen.bounds is the same as for the mainScreen's bounds. Also as mentioned in my question, forcing the window (which is as far as I know the outermost layer I can access) to be a different size doesn't solve the issue. The window itself seems to be clipped inside those 320x480pt bounds.

Though the reason self.view.window.windowScene.screen.bounds has the same value is probably that the window initialized in the App Delegate still uses the +[UIScreen mainScreen] to set its frame size. Can I somehow access the correct value in the AppDelegate?

I would really appreciate a framework engineer's feedback here. I can't seem to figure out how to solve the issue. I have thought about using a storyboard setup for the app, but this would result in a lot of overhead work. Also, I don't even know if the issue would actually be resolved this way. I simply suspect it would be, since newly created objective c projects (which use storyboards by default) are displayed as you would expect.

This question needs to be answered. This behavior is broken in iOS 16.

Objective C App has wrong [UIScreen mainScreen].bounds value since iOS 16
 
 
Q