Ionic cordova-plugin-screen-orientation 在 Ios 上不再有效

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

自从我更新了所有内容后,我在使用 screen orientation plugin 时遇到了一些问题。我已经有一个 运行 应用程序,一切正常。但是由于我将每个插件以及 cordova 和 ionic 环境更新为最新版本,我的屏幕方向插件不再起作用。

config.xml配置

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

已安装的插件

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

科尔多瓦版本6.1.1

离子版本1.7.14

Javascript代码

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

屏幕已定义,但函数调用无效。我不知道为什么它不再起作用了。我用 Iphone 5 (ios 9.2.1) 和不同的模拟器试过了。

使用我的 android 设备一切正常。

这看起来像是 cordova 屏幕方向插件的问题。 iOS 中的 cordova 6x 版本已损坏。这个问题仍然悬而未决,工作正在进行中。请根据插件作者的评论查看此 link 以获得更多 info.As,问题修复尚未合并,但如果您有兴趣,可以去 git 拉测试相同的内容。希望对你有帮助。