【问题标题】:Cordova Application crashed when started using Mobile First Platform 8Cordova 应用程序在开始使用 Mobile First Platform 8 时崩溃
【发布时间】: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 #

标签: cordova ibm-mobilefirst


【解决方案1】:

这是一个缺陷。请打开 PMR 以跟踪问题。

【讨论】:

    【解决方案2】:

    请使用 cordova-windows 版本 5.0.0 。此版本的 cordova-windows 中提供了此问题的修复程序。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-05
      • 2020-07-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多