iOS16 safeAreaInsets are 0 when App launched while device is rotated

When I launched my app while the device is rotated, safeAreaInsets are 0. The problem is, the view overlaps with the status bar. (ie. wifi, battery icon)

Steps to reproduce:

  1. Created a simple app with a UIViewController.
  2. Set the ViewController to work as portrait (though the device is rotated)
   override public var supportedInterfaceOrientations: UIInterfaceOrientationMask {
    return .portrait
  }

print(view.safeAreaInsets) on viewDidAppear prints UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: 0.0)

Confirmed safeAreaInsets doesn't get changed afterwards by adding below.

   override public func viewSafeAreaInsetsDidChange() {
    super.viewSafeAreaInsetsDidChange()
    print("SafeAreaInsetsDidChange")
  }

This was fine in iOS15. Does anyone have any idea why?

Looks like this only happens with iPhone8.

Not only iPhone 8, this is also happening on iPads

iOS16 safeAreaInsets are 0 when App launched while device is rotated
 
 
Q