I have successfully added a Facebook login button to a view (also tried adding it to a window). The button works in bringing up the Facebook login modal, but after successfully signing in, nothing happens... it does not change the state of the login button (to logout) or fire the "login" eventlistener.
Could someone please have a look at what I am doing wrong?
exports.login = function(){ var ht = Ti.Platform.displayCaps.platformHeight - (Math.round((25 * Ti.Platform.displayCaps.dpi)/160) + Math.round((80 * Ti.Platform.displayCaps.dpi)/160)); var xmlhttp = Titanium.Network.createHTTPClient(); Titanium.Facebook.appid = "XXXXXXXXX"; Titanium.Facebook.permissions = ['publish_stream', 'read_stream','email']; Ti.App.viewLogin = Ti.UI.createView({ top: Math.round((80 * Ti.Platform.displayCaps.dpi)/160), left:0, right:0, bottom: 0, backgroundImage:'../images/background.png', zIndex:99 }); // Main View var loginView = Titanium.UI.createScrollView({ contentWidth: 'auto', contentHeight: 'auto', top:'0dp', layout:'vertical', showVerticalScrollIndicator: true }); var fbLogin = Titanium.Facebook.createLoginButton({ style:'wide', top:'85dp', }); Ti.App.viewLogin.add(loginView); Ti.App.viewLogin.add(fbLogin); Ti.UI.currentWindow.add(Ti.App.viewLogin); Titanium.Facebook.addEventListener('logout', function(e){ alert("Logout"); }); Ti.Facebook.addEventListener('login',function(e){ if(Titanium.Facebook.loggedIn) { Titanium.Facebook.requestWithGraphPath('me', {}, 'GET', function(e) { var userInfo = JSON.parse(e.result); alert(userInfo.id); }); } }); };