문제

i added my facebook login button to my login page which then re-directs users to the tabgroup. My question is; (instead of both fb login/logout button to be in the same page) how can i make the fb login button appear on the login page and then make the fb logout page appear in one of my tabs or another page.

도움이 되었습니까?

해결책

Then you could make the custom one

Here is the method

facebook login

 Ti.Facebook=Titanium.Facebook = require('facebook');
    Ti.Facebook.appid = FACEBOOK_APP_ID;
    Ti.Facebook.permissions = ['publish_stream']; // Permissions your app needs
    Ti.Facebook.forceDialogAuth = true;
    var btnLogin = Titanium.UI.createButton({
       title: 'Hello',
       top: 10,
       width: 100,
       height: 50
    });
    win.add(btnLogin);
    btnLogin.addEventListener('click',function(e)
    { 
    Ti.Facebook.addEventListener('login', function(e) {
        if (e.success) {
            alert('Logged In');
        } else if (e.error) {
            alert(e.error);
        } else if (e.cancelled) {
            alert("Canceled");
        }
    });
    Ti.Facebook.authorize();
    });

and FB logout

    var btnLogout = Titanium.UI.createButton({
       title: 'Hello',
       top: 10,
       width: 100,
       height: 50
    });
    win2.add(btnLogout);
    btnLogout.addEventListener('click',function(e)
    {
     Ti.Facebook.addEventListener('logout', function(e) {
        alert('Logged out');
    });
    Ti.Facebook.logout();
});

Thanks

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top