Getting Unable To Rotate Device error on iOS

Hello everyone,

I am struggling on the app rotation problem. It works on one machine, but on another we get error: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Unable To Rotate Device

The exception is thrown on this line:

driver.rotate(ScreenOrientation.LANDSCAPE);

Surprisingly it changes to the landscape and then crashes.

IOSDriver capabilities:
capabilities.setCapability(“deviceOrientation”, “portrait”); //For real device
capabilities.setCapability(MobileCapabilityType.ORIENTATION, ScreenOrientation.PORTRAIT); // For sim/emulator

Appium Verison: 1.22.2
Fails on iOS simulator (iPad mini, OS: 15.2)

Would appreciate any help.

Update:
As a workaround we ignored the exception:

try {
    driver.rotate(ScreenOrientation.LANDSCAPE); 
    } catch (WebDriverException ignore) {
    //Ignore the exception
}