0

I am following this WebSphere Commerce guide for Worklight store fronts, to use Hybrid applications using IBM Worklight 5.0.5.

The application launches successfully, however after setting up the connection details for the store front in the app, and saving them - the store front, which is another Worklight Hybrid app located on a WebSphere Commerce server, is not initializing correctly.

Instead of loading correctly, I get this error message:

Uncaught TypeError: Cannot call method 'init' of undefined at 192.168.16.96/wcsstore/Aurora/mobile20/WorklightHybrid/android/js/initOptionsApp‌​‌​‌​.js:64

HTML File Code:

<body id="content" class="bg_splash" style="display: none;">
    <!-- application UI goes here -->
    <div class="wrapper">
        <div id="splashscreen" class="splash_logo_container splash_logo_position splash_logo"></div>
        <div id="pagePort" class="hidden"></div>
    </div>
    <script src="js/version.js"></script>
    <script src="js/messages.js"></script>
    <script src="js/messages_en_US.js"></script>
    <script src="js/messages_fr_FR.js"></script>
    <script src="js/messages_de_DE.js"></script>
    <script src="js/messages_it_IT.js"></script>
    <script src="js/messages_es_ES.js"></script>
    <script src="js/messages_pt_BR.js"></script>
    <script src="js/messages_zh_CN.js"></script>
    <script src="js/messages_zh_TW.js"></script>
    <script src="js/messages_ko_KR.js"></script>
    <script src="js/messages_ja_JP.js"></script>
    <script src="js/messages_ko_KR.js"></script>
    <script src="js/messages_ru_RU.js"></script>
    <script src="js/messages_ro_RO.js"></script>
    <script src="js/messages_pl_PL.js"></script>
    <script src="js/WCLocalStorage.js"></script>
    <script src="js/WCHybrid.js"></script>
    <script src="js/initOptions.js"></script>
</body>

initOptions.js

//Worklight Client initialization parameter array
var wlInitOptions = {
//Application should not attempt to connect to Worklight Server on application start up
connectOnStartup : false,
//Should application produce logs
enableLogger : true,
//Should direct updates prompt the user or occur silently
updateSilently: false
};

var initOptionsApp = (function() {

return {
    /**
     * Called when Cordova runtime has initialized
     */
    onDeviceReady: function() {
        var METHODNAME = "initOptionsApp.onDeviceReady";
        if (wlInitOptions.enableLogger) {
            WL.Logger.debug(METHODNAME, "ENTRY");
        }          
        //bind the hardware back button event listener
        document.addEventListener("backbutton", WCHybridApp.onBackKeyDown, false);
        if (wlInitOptions.enableLogger) {
            WL.Logger.debug(METHODNAME, "EXIT");
        }
    }
};

})();

/**
* Bind the Worklight Client initialization call to the page load event
*/
if (window.addEventListener) {
window.addEventListener('load', function() { WL.Client.init(wlInitOptions); }, false);
window.addEventListener('unload', function() { WCHybridApp.updateHistory(); }, false);
} else if (window.attachEvent) {
window.attachEvent('onload',  function() { WL.Client.init(wlInitOptions); });
}

/**
 * Bind events to the Cordova deviceready event
 */
if (document.addEventListener) {
document.addEventListener("deviceready", initOptionsApp.onDeviceReady, false);
}

Edit: The below was fixed after upgrading to Worklight 5.0.6.1

When I load my application on emulator its prompt unexpected three different dialog as can be seen in the images below.

enter image description here More examples here:

4

1 に答える 1

1

これらの Cordova 関連のダイアログが表示される場合は、通常、アプリケーションで使用している Cordova のバージョンに問題があることを意味します。

Eclipse Java EE 4.2.2 (Juno SR2) から始めて、Worklight Developer Edition (Eclipse Marketplace から v5.0.6.1) をインストールすることを強くお勧めします。これで解決しそうです。

編集:編集された質問から、それは持っています。

現在、initOptions のリーミングの問題は次のようなものです: Uncaught ReferenceError: wlInitOptions is not defined

于 2013-05-06T16:09:38.007 に答える