Per platform configuration (config.xml) on PhoneGap Build

偶尔善良 提交于 2019-12-10 17:44:27

问题


I have a PhoneGap 3.1 application that I build remotely on PhoneGap Build.
In my app there is a single config.xml file at the root of the project. This file contains:

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

However I would like to restrict the orientation to portrait mode in iOS. I've randomly tried :

<preference gap:platform="ios" name="orientation" value="portrait" />

and

<gap:platform name="ios">
    <preference name="orientation" value="portrait" />
</gap:platform>

but none of these seem to work.

How can I set preferences for specific platforms?


回答1:


With PGB we now have the ability to add to the info.plist file. So in your config.xml put this:

<gap:config-file platform="ios" parent="UISupportedInterfaceOrientations" overwrite="true">
   <array>
      <string>UIInterfaceOrientationPortrait</string>
   </array>
</gap:config-file>

Read more and see this exact example here: http://phonegap.com/blog/2014/01/30/customizing-your-android-manifest-and-ios-property-list-on-phonegap-build/



来源:https://stackoverflow.com/questions/20998325/per-platform-configuration-config-xml-on-phonegap-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!