2014-07-10 32 views
1

我正在使用IBM Worklight 6.1.0並在iOS 7設備上進行測試。用戶註銷時無法取消訂閱eventSource

當測試我的應用程序並嘗試註銷時,我仍訂閱了eventSource。

這是我的代碼是:

function logout() { 
    console.log('logout'); 

    WL.Client.logout('FahrAuthRealm',{onSuccess:function(){ 
     WL.Client.updateUserInfo(); 
     console.log('logout Success'); 

     WL.Client.Push.unsubscribe("myPush", { 
      onSuccess: function() {alert("unsubscribe myPush success");}, 
      onFailure: function() {alert("unsubscribe myPush failed");} 
     }); 
     router.navigate("#home",true); 
    }}); 
} 

有什麼錯我的代碼? 爲什麼我不能取消訂閱eventSource?

+0

它會更好,如果你提到爲什麼你認爲您仍然登錄,並且您在註銷時在Xcode控制檯中是否看到任何錯誤... –

回答

2

我想你可能應該先取消,只有然後註銷的境界...
也許這將更好地工作:

function logout() { 
    WL.Client.Push.unsubscribe("myPush", { 
     onSuccess: function() { 
      alert("unsubscribe myPush success"); 
      WL.Client.logout("FahrAuthRealm", { 
       onSuccess: function() { 
        WL.Client.updateUserInfo(); 
        router.navigate("#home",true); 
       } 
      }); 
     }, 
     onFailure: function() { 
      alert("unsubscribe myPush failed"); 
     } 
    }); 
}