0
votes

I build Cordova application that has cordova-plugin-mfp plugin(IBM Mobile First Platform 8). But this application crashed when started.

I guess cordova-plugin-mfp has problem in 'bootstrap.js'. WL.Client.init can be called before initialize (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();
}

So I add this element to config.xml

    <mfp:clientCustomInit enabled="true" />

and add the event handler in my application code(below).

document.addEventListener('mfpjsloaded',
                          function() {
                               WL.Client.init(wlInitOptions);
                          },
                          false);

I'm searching better workaround or patch for this problem.

Can anyone tell me any advice?

My environment

  • OS: Window 10 Pro 1607
  • Cordova : 6.5.0
  • nodeJS : 6.10.3
  • VS : Visual Studio 2015 Update 3
  • cordova-windows : 4.3.2
  • cordova-plugin-mfp : 8.0.2017033009
2
Is the issue intermittent or consistent? If this seen without making any modifications ? ie, you create a project, build and run and it crashes? - Vivin K
This issue is consistent. I recreate new project like bellow - echoview2
$ cordova create FooBarApp com.example.fooBar FooBarApp $ cd FooBarApp $ cordova platform add [email protected] $ cordova run # <--- started successfully $ cordova plugin add cordova-plugin-mfp $ cordova run # <--- crashed - echoview2

2 Answers

0
votes

This is a defect. Please open a PMR to track the issue.

0
votes

Please use cordova-windows version 5.0.0 . The fix for this issue was provided in this version of cordova-windows.