【发布时间】:2017-06-19 20:40:50
【问题描述】:
我构建了具有 cordova-plugin-mfp 插件(IBM Mobile First Platform 8)的 Cordova 应用程序。但是这个应用程序在启动时崩溃了。
我猜想 cordova-plugin-mfp 在“bootstrap.js”中有问题。 WL.Client.init 可以在初始化之前调用(WL.Client == undefined)。
// plugins/cordova-plugin-mfp/bootstrap.js
function mfpready (){
mfpFire();
//call WL.Client.init unless user defined mfpClientCustomInit = true in config.xml, and propagated to static_app_props.js
if(WL.StaticAppProps && !WL.StaticAppProps.mfpClientCustomInit){
console.log('Calling WL.Client.init(wlInitOptions);')
var options = typeof wlInitOptions !== 'undefined' ? wlInitOptions : {};
WL.Client.init(options);
} else {
console.log('Developer will call WL.Client.init manually');
}
//Inform developer they should load their own jquery and not use MFP internal version
deprecateWLJQ();
}
所以我将此元素添加到 config.xml
<mfp:clientCustomInit enabled="true" />
并在我的应用程序代码中添加事件处理程序(如下)。
document.addEventListener('mfpjsloaded',
function() {
WL.Client.init(wlInitOptions);
},
false);
我正在为这个问题寻找更好的解决方法或补丁。
谁能告诉我任何建议?
我的环境
- 操作系统:Window 10 Pro 1607
- 科尔多瓦:6.5.0
- nodeJS:6.10.3
- VS:Visual Studio 2015 更新 3
- cordova 窗口:4.3.2
- cordova-plugin-mfp:8.0.2017033009
【问题讨论】:
-
问题是间歇性的还是一致的?如果这个看到没有做任何修改?即,您创建一个项目,构建并运行它并崩溃?
-
这个问题是一致的。我像下面这样重新创建新项目
-
$ cordova create FooBarApp com.example.fooBar FooBarApp $ cd FooBarApp $ cordova platform add windows@4.3.2 $ cordova run #