IBM Worklight - AppCenter app missing Plugin '

2019-07-19 08:36发布

问题:

I'm having the same problem as this user. I've built the IBM Worklight AppCenter client application using eclipse (AppCenter -> Run As -> Build All Environments) opened it in xcode (iphone -> Run As -> Xcode project) and run the app in the iphone emulator via xcode.

After I enter my Worklight server credentials in the app (username, password, server, port, context) a "Loading" message is displayed and the app ceases functioning.

I've debugged through the app's javascript and traced the problem to the app trying to execute a call to a Cordova native plugin:

cordova.exec(pSuccessCallback,                      // Success callback from the plugin
                     function(e){     
                        console.log("Error connecting to server [code, msg, status] = " 
                                + e.errorCode + ", "
                                + e.errorMsg + ", "
                                + e.httpCode);

                        pFailureCallback(e);
                     },                              
                     'com.ibm.mobile.InstallerPlugin',      // Tell cordova to run "com.ibm.mobile.InstallerPlugin" Plugin
                     'updateConnection',                    // Tell plugin, which action we want to perform
                     [pUsername, pPassword, pServerURL]);   // Passing list of args to the plugin         

This error message is displayed in xcode: IBMAppCenter[2315:70b] ERROR: Method 'updateConnection:' not defined in Plugin 'com.ibm.mobile.InstallerPlugin'

The native libraries implementing this plugin are in their expected locations but don't appear to seen by the application - IBMAppCenter/apps/AppCenter/iphone/native/appCenterLib:

  • Debug-iphoneos/libAppCenterInstallerLib.a
  • Release-iphoneos/libAppCenterInstallerLib.a
  • Debug-iphonesimulator/libAppCenterInstallerLib.a
  • Release-iphonesimulator/libAppCenterInstallerLib.a

Are there any additional steps required to include the native libraries in the application?

Any help would be greatly appreciated.

回答1:

The method "updateConnection" is defined in the InstallerPlugin. I think it is simply the first method to be called of the InstallerPlugin, hence the problem might be that you accidentally removed the installer plugin.

The directory IBMAppCenter/apps/AppCenter/iphone/native/appCenterLib must contain the different versions of libAppCenterInstallerLib.a:

  • Debug-iphoneos/libAppCenterInstallerLib.a
  • Release-iphoneos/libAppCenterInstallerLib.a
  • Debug-iphonesimulator/libAppCenterInstallerLib.a
  • Release-iphonesimulator/libAppCenterInstallerLib.a

The method updateConnection is contained in libAppCenterInstallerLib.a.

If those libs are missing, you can copy them from the original installation directory of IBM Worklight.

Please never delete the native directories of IBMAppCenter/apps/AppCenter before regenerating the iphone or Android environment. If you delete the native directories, you delete those required libraries, and then the AppCenter client is not functional.



回答2:

I managed to fix this by upgrading to Worklight 6.1.

In recent versions of Cordova, the Plugin method signature has changed.

Verify this by extracting the libAppCenterInstallerlib.a with:

ar -x libAppCenterInstallerlib.a

then run:

nm IBMAppCenterPlugin.o

look for the initInfo or updateConnection methods. If they have :withDict in the method signature, then this is deprecated in recent versions of Cordova.

Using the AppCenter project from Worklight 6.1, I no longer see this issue.