我对 Phonegap 很陌生。我正在尝试构建一个需要 InApBrowser 插件的应用程序。
我知道我们不应该将 cordova.js 上传到 PhoneGap 构建服务器,但我不确定是否需要上传 cordova_plugin.js 到构建服务器。我问这个问题是因为当我下载 .ipa 包并将其安装在 iPhone 中并调试应用程序时,它说
cordova_plugin.js not found.
我正在使用科尔多瓦 3.6.3。
索引.html
<body>
<p>Hello, your application is ready!</p>
<!-- Cordova reference, this is added to your app when it's built. -->
<script src="cordova.js"></script>
<script src="scripts/platformOverrides.js"></script>
<script src="scripts/index.js"></script>
</body>
配置文件
<?xml version="1.0" encoding="utf-8"?>
<widget xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:vs="http://schemas.microsoft.com/appx/2014/htmlapps" id="io.cordova.Plugintest" version="1.0.0.0" xmlns="http://www.w3.org/ns/widgets">
<name>Plugin_test</name>
<description>
A blank project.
</description>
<author href="http://cordova.io" email="[email protected] /cdn-cgi/l/email-protection">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<preference name="SplashScreen" value="screen" />
<vs:features>
<vs:feature>[email protected] /cdn-cgi/l/email-protection</vs:feature>
<vs:feature>[email protected] /cdn-cgi/l/email-protection</vs:feature>
</vs:features>
<vs:platformSpecificValues />
</widget>
但它仍然无法在 iPhone 上运行
有人可以帮我解决这个问题吗?
不,您不需要包括cordova_plugins.js到 PhoneGap 构建。对于 InAppBrowser,您需要做的是包含
<gap:plugin name="org.apache.cordova.inappbrowser" version="0.5.2" />
进入你的配置文件。之后,PhoneGap Build 将负责为您注入所有必需的 JavaScript 文件。你也不需要做类似的事情
<script type="text/javascript" src="cordova_plugin.js"></script>
这在您的应用程序中,因为 PGB 会为您处理它。这是使用 PGB 的主要好处之一。
Update
这是例子配置文件来自我的一个项目
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example.com" version="0.0.1"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0"
xmlns:gap="http://phonegap.com/ns/1.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<name>Plugin_test</name>
<description>
A blank project.
</description>
<author href="http://cordova.io" email="[email protected] /cdn-cgi/l/email-protection">
Apache Cordova Team
</author>
<content src="index.html"/>
<access origin="*"/>
<!-- PhoneGap plugins for PhoneGap Build to attach to build -->
<gap:plugin name="org.apache.cordova.device" version="0.2.12" source="pgb" />
<gap:plugin name="org.apache.cordova.inappbrowser" version="0.5.2" source="pgb" />
<gap:plugin name="org.apache.cordova.splashscreen" version="0.3.4" source="pgb" />
<!-- Use the newest version of PhoneGap -->
<preference name="phonegap-version" value="3.6.3" />
<!-- Device permission is needed -->
<feature name="http://api.phonegap.com/1.0/device"/>
<!-- Splash icon is on same directory as this file -->
<gap:splash src="splash.png" />
</widget>
我只留下了您可能需要的详细信息,例如插件(splash、设备和 InAppBrowser)以及您正在使用的权限
还要移动配置文件 under www文件夹,如果还没有的话
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)