在PhoneGap Build上的每个平台配置(config.xml) [英] Per platform configuration (config.xml) on PhoneGap Build

查看:303
本文介绍了在PhoneGap Build上的每个平台配置(config.xml)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PhoneGap 3.1应用程序,我在PhoneGap Build上远程构建。

在我的应用程序中有一个 config.xml 文件项目的根。此文件包含:

 < preference name =orientationvalue =default/& 

但是我想限制iOS中的纵向模式的方向。
我已随机尝试:

 < preference gap:platform =iosname =orientationvalue =portrait/> 

 < gap:platform name =ios> 
< preference name =orientationvalue =portrait/>
< / gap:platform>

但这些似乎都无效。



如何设置特定平台的首选项?

解决方案

使用PGB,我们现在可以添加到info.plist文件。所以在你的config.xml中这样:

 < gap:config-file platform =iosparent =UISupportedInterfaceOrientations overwrite =true> 
< array>
< string> UIInterfaceOrientationPortrait< / string>
< / array>
< / gap:config-file>阅读更多,在这里看到这个确切的例子:






< /phonegap.com/blog/2014/01/30/customizing-your-android-manifest-and-ios-property-list-on-phonegap-build/rel =nofollow> http://phonegap.com/ blog / 2014/01/30 / customizing-your-android-manifest-and-ios-property-list-on-phonegap-build /


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?

解决方案

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/

这篇关于在PhoneGap Build上的每个平台配置(config.xml)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆