3

次のコードでは、接続が成功したときに onSuccess がコールバックされていません。一連のイベントのコードとログ出力をリストしました。コードの設定が間違っていませんか?initOptions で connectOnStartup が false に設定されています。このコードはシェル プロジェクトにもあり、logcat はシェルを使用して内部プロジェクトから取得されます。

function onConnectSuccess(){
    console.log ("CSXMobile:onConnectSuccess");
    WL.Logger.debug("CSXMobile:onConnectSuccess");
}

function onConnectFailure(){
    WL.Logger.debug("CSXMobile:onConnectFailure");
}

function disconnectDetected(){
    WL.Logger.debug("CSXMobile:disconnectDetected");
}

function connectDetected(){
    WL.Logger.debug("CSXMobile:connectDetected");
}

function wlCommonInit(){

    WL.Logger.debug("CSXMobile:wlCommonInit");
    document.addEventListener(WL.Events.WORKLIGHT_IS_CONNECTED, connectDetected, false); 
    document.addEventListener(WL.Events.WORKLIGHT_IS_DISCONNECTED, disconnectDetected , false);

     WL.Client.connect({
         onSuccess: onConnectSuccess,
         onFailure: onConnectFailure
     });
}

ここのログに見られるように、wlCommonInit が呼び出されてログに記録されていますが、onConnectSuccess のログ ステートメントは決して書き込まれません...

11-21 13:49:01.460: D/CSXMobileShellTest(6341): wlclient init started
11-21 13:49:01.460: D/CSXMobileShellTest(6341): Read cookies: null
11-21 13:49:01.460: D/CSXMobileShellTest(6341): CookieMgr read cookies: {}
11-21 13:49:01.507: D/dalvikvm(6341): GC_CONCURRENT freed 311K, 4% free 11407K/11783K, paused 2ms+16ms, total 34ms
11-21 13:49:01.507: D/CordovaNetworkManager(6341): Connection Type: wifi
11-21 13:49:01.507: D/DroidGap(6341): onMessage(networkconnection,wifi)
11-21 13:49:01.507: D/DroidGap(6341): onMessage(spinner,stop)
11-21 13:49:01.507: D/CordovaLog(6341): CSXMobile:csxmobileDeviceReady
11-21 13:49:01.507: I/Web Console(6341): CSXMobile:csxmobileDeviceReady at file:///data/data/com.csx.CSXMobileShellTest/files/www/default/js/CSXMobile.js:172
11-21 13:49:01.538: D/CSXMobileShellTest(6341): CSXMobile:deviceOnline
11-21 13:49:01.546: D/CSXMobileShellTest(6341): before: app init onSuccess
11-21 13:49:01.546: D/CSXMobileShellTest(6341): CSXMobile:wlCommonInit
11-21 13:49:01.561: D/CSXMobileShellTest(6341): Request [https://myworklightserver/query]
11-21 13:49:01.585: D/CSXMobileShellTest(6341): after: app init onSuccess
11-21 13:49:01.585: D/CSXMobileShellTest(6341): added onPause event handler 
11-21 13:49:01.585: D/CSXMobileShellTest(6341): wlclient init success
11-21 13:49:01.858: D/CSXMobileShellTest(6341): isCustomResponse
11-21 13:49:01.858: D/CSXMobileShellTest(6341): isCustomResponse true
11-21 13:49:01.858: D/CSXMobileShellTest(6341): handleChallenge
11-21 14:14:57.796: D/DroidGap(6656): onMessage(spinner,stop)
11-21 14:15:08.975: D/CSXMobileShellTest(6656): Request [login]
11-21 14:15:09.132: D/CSXMobileShellTest(6656): Status =401
11-21 14:15:09.132: D/CSXMobileShellTest(6656): isCustomResponse
11-21 14:15:09.139: D/CSXMobileShellTest(6656): isCustomResponse false
11-21 14:15:09.147: D/CSXMobileShellTest(6656): Request [https://myworklightserver/query]
11-21 14:15:09.163: D/CSXMobileShellTest(6656): hideLogin
11-21 14:15:09.413: D/Cordova(6656): onPageFinished(file:///data/data/com.csx.CSXMobileShellTest/files/www/default/CSXMobileShellTest.html#testMainPage)
11-21 14:15:09.413: D/Cordova(6656): Trying to fire onNativeReady
11-21 14:15:09.413: D/DroidGap(6656): onMessage(onNativeReady,null)
11-21 14:15:09.413: D/DroidGap(6656): onMessage(onPageFinished,file:///data/data/com.csx.CSXMobileShellTest/files/www/default/CSXMobileShellTest.html#testMainPage)
11-21 14:15:09.475: D/CSXMobileShellTest(6656): Request [https://myworklightserver/query]
11-21 14:15:09.522: D/CSXMobileShellTest(6656): Request [https://myworklightserver/query]
11-21 14:15:09.616: D/CSXMobileShellTest(6656): isCustomResponse
11-21 14:15:09.616: D/CSXMobileShellTest(6656): isCustomResponse false
11-21 14:15:09.616: D/CSXMobileShellTest(6656): CSXMobile:connectDetected
11-21 14:15:09.647: D/CSXMobileShellTest(6656): response [https://myworklightserver/query] success: /*-secure-
4

1 に答える 1

2

IBM の連絡先に ping を送信して、フィードバックを得ることができました。WL.Client.createChallengeHandler と組み合わせて challengeHandler を実装しています。私が省略した重要な項目の 1 つは、challengeHandler.submitSuccess(); を実行することでした。ログイン成功後。成功したログイン ルーチンにその行を追加すると、すべてが正常に機能しました。

于 2013-11-26T18:10:30.937 に答える