Failed to switch between landscape and portrait on ios16

I have an iOS app that is using SDL-2.24.0 and has been working fine before. After upgrading iOS to iOS16, the landscape and portrait screen switching fails.

How can I fix this? Does the newer version of SDL solve this bug?