Cordova:iOS和iPad停留在纵向模式

Cordova:iOS和iPad停留在纵向模式,ios,cordova,ipad,Ios,Cordova,Ipad,我在根目录中的config.xml中添加了以下内容 但它似乎没有效果,应用程序被困在肖像模式。我还确保禁用方向锁定 有什么想法吗 <?xml version='1.0' encoding='utf-8'?> <widget id="com.ameba.mobile.api" android-versionCode="5" version="1.4" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://c

我在根目录中的config.xml中添加了以下内容

但它似乎没有效果,应用程序被困在肖像模式。我还确保禁用方向锁定

有什么想法吗

<?xml version='1.0' encoding='utf-8'?>
        <widget id="com.ameba.mobile.api" android-versionCode="5" version="1.4" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
            <preference name="SplashScreen" value="splash" />
            <preference name="SplashScreenDelay" value="3000" />
    .......
            <content src="index.html" />
            <plugin name="cordova-plugin-whitelist" version="1" />
            <access origin="*" />
            <platform name="android">
                <allow-intent href="market:*" />
            </platform>
            <platform name="ios">
                <preference name="orientation" value="default" />
                <allow-intent href="itms:*" />
                <allow-intent href="itms-apps:*" />
            </platform>
        </widget>

.......

这是一个bug,iPad的默认方向应该是所有方向

无论如何,如果你想在iPhone和iPad上拥有所有方向,你可以使用“所有”方向值

<preference name="orientation" value="all" />

为了扩展jcesarmobile的答案,“default”标志将删除项目中的所有方向首选项,对于iOS,这意味着XCode不会用所有值重新填充plist,而是将其保留为空

对于我的特定项目,我必须将其包装在一个平台标记中,以避免准备错误:

<platform name="ios">
  <preference name="Orientation" value="all" />
</platform>

这有助于: