未加载 PhoneGap 内置应用程序浏览器



我有一个Phonegap应用程序,它通过Phonegap开发iOS应用程序的本地服务器完美运行。

具体来说,调用

var ref = cordova.InAppBrowser.open('https://subdomain.domain.com', '_blank', 'location=no');

在开发应用程序中工作正常,但是当推送到 PhoneGap 构建并通过通过 TestFlight 安装的应用程序访问时,使用 Hydration 轻松更新,该按钮完全没有响应。

我有一种感觉,没有加载任何插件,因为状态栏也出现故障。

以下是 config.xml 文件的相关部分:

<plugin name="cordova-plugin-inappbrowser" spec="~1.7.0" />
<plugin name="cordova-plugin-statusbar" />
<plugin name="cordova-plugin-whitelist" spec="1.3.1" />

我知道这样做的不安全性,但是,更改为我尝试访问的 url 不会改变任何内容:

<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<allow-intent href="*" />
</platform>

有问题的按钮:

<a href="#" id="signUpButton" class="btn btn-default appButton appAlt"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> OR SIGN UP</a>

与此按钮相关的 JavaScript:

document.addEventListener("deviceready", function(){
deviceReadyDependantFunctions();
initializeApplication();
});
function deviceReadyDependantFunctions(){
alert('initialised!');
$('#signUpButton').unbind().click(function(){
console.log('here');
var ref = cordova.InAppBrowser.open('https://subdomain.domain.com?some=variable', '_blank', 'location=no');
ref.addEventListener('loadstart', function(event) { alert(event.url); });
console.log(ref);
});
}

显然,那里有一堆调试....

"初始化"警报在所有环境中触发。

event.url警报在开发应用中触发,但不在试飞、水合应用程序中触发。

我一直在尝试我能找到的一切来纠正这个问题......我找到的唯一解决方案是使用一个简单的href="theUrl.com"并让系统浏览器加载它。这根本不是解决方案...我需要在应用程序中加载网址。这是一个注册页面,必须可以从应用程序访问它。

我尝试过的事情:

白名单的每一次渗透,尽管有不同的文档说在应用程序浏览器中受白名单插件的影响/不受。

使用不同版本的 phonegap (<preference name="phonegap-version" value="cli-6.5.0" />) 无济于事。

已检查插件是否存在于phonegap构建"插件"选项卡中。

尝试将 cordova.js 的引用替换为 phonegap.js。这根本不起作用。

加载 js 文件的顺序(上面对 inappbrowser 的调用在单独的 js 文件中)。没有区别。

我做错了什么?!

还是测试飞行/水合应用程序组合有什么奇怪的地方?

您可以在此处看到我所做的荒谬提交以及完整的代码库:

https://github.com/andycharrington/yfa/commits/master

任何建议将不胜感激。

谢谢。

今天早上使用Phone Gap Build重新编译未更改的代码似乎神奇地修复了它。当这种情况发生时,你不就是喜欢它吗?:)

相关内容

最新更新