Simon Schüpbach
Simon Schüpbach

Reputation: 2683

Ionic cordova-plugin-screen-orientation doesn't work anymore on Ios

I've got some trouble with the screen orientation plugin since I updated everything. I have already a running app where everything works fine. But since I update every plugin and the cordova and ionic environment to the latest version my screen orientation plugin doesn't work anymore.

config.xml configuration

<preference name="Orientation" value="portrait"/>

installed plugins

cordova-plugin-screen-orientation 1.4.0 "Screen Orientation"
org.adlotto.cordova.recheck-screen-orientation 0.1.0 "RecheckScreenOrientation"

cordova version 6.1.1

ionic version 1.7.14

Javascript code

// to lock screen in portrait mode
screen.lockOrientation('portrait-primary'); // it doesn't work neither with 'portrait'
...
// unlock orientation
screen.unlockOrientation();

screen is defined but the function calls have no effect. I don't know why it doesn't work anymore. I tried it with my Iphone 5 (ios 9.2.1) and different emulators.

With my android device everything works as expected.

Upvotes: 2

Views: 2042

Answers (1)

Gandhi
Gandhi

Reputation: 11935

This looks like an issue with cordova screen orientation plugin. Its broken for cordova 6x versions in iOS. The issue is still open and work in progress. Please check this link for more info.As per the plugin author's comment, the issue fix is not yet merged but you can go git pull to test the same if you are interested. Hope it helps.

Upvotes: 1

Related Questions