iOS 13/13.1 autorotation seems to be behave differently than iOS 12. For instance, my app allows user to lock interface orientation to portrait or landscape mode in settings.
If I have portrait rotation lock on device and return .landscape in supportedInterfaceOrientations, the interface remains in portrait mode until I disable portrait lock orientation on device. This does not seem to be the case with iOS 12. Infact, supportedInterfaceOrientations is not even called in iOS 13!
UIViewController.attemptRotationToDeviceOrientation() also does not work in such cases.
The root of the problem is I temporarily return shouldAutorotate to false while the app is initializing and when everything is initialized, I call UIViewController.attemptRotationToDeviceOrientation() to trigger autorotation. It triggers autorotation in iOS 12 but in iOS 13.1 it doesn't works.
Looks like a bug in iOS 13.1 probably. What do I do to force trigger autorotation?
EDIT: Looks like iOS 12.4.1 also ignores UIViewController.attemptRotationToDeviceOrientation(). There is something broken in autorotation in iOS 12.4.1 & above.
To be clear, this is what I want:
a. Even if portrait lock is set on iPhone, I wish my interface to autorotate to landscape mode if required,
b. UIViewController.attemptRotationToDeviceOrientation() alternative that triggers autorotation in all circumstances.