Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Facebook - isLoggedIn() on app launch

I've noticed an error with the Facebook module's isLoggedIn() method.

When I re-start my app after having logged in to Facebook, my isLoggedIn() check returns false. However, on my settings screen the Facebook button is in the logged-in state (grey button with 'Logout' text).

Is there an error with this method and if so, is there a documented fix for it?

Thanks,
Sean

— asked August 26th 2010 by Sean McEmerson
  • app
  • facebook
  • iphone
  • isloggedin
  • launch
0 Comments

4 Answers

  • Anyone?? I know I'm not the only one experiencing this. It would be good to get some official clarification.

    — answered August 31st 2010 by Sean McEmerson
    permalink
    0 Comments
  • Anyone?? I know I'm not the only one experiencing this. It would be good to get some official clarification.

    — answered August 31st 2010 by Sean McEmerson
    permalink
    0 Comments
  • I'm working on a solution to this at the moment. So far I've found that you need to add a button to the window first. That must send a request to Facebook to check your login status because if you set a timeout and check if the user is logged in after a few seconds, you'll get loggedIn = true. The problem is that the login event doesn't fire this way.

    Haven't looked into this in too much detail yet but this post may be useful:
    http://developer.appcelerator.com/question/1481/tifacebookisloggedin-isnt-accurate

    — answered September 23rd 2010 by Charles Davison
    permalink
    0 Comments
  • I do this in the function were i check if i need to open my settings screen or i can just open the facebook window:

    var fbButton = Titanium.Facebook.createLoginButton({
      'style':'wide',
      'apikey':'apikey',
      'sessionProxy':'sessionProxy'
    });
    
    win.add(fbButton);
    win.remove(fbButton);
    
    Ti.API.info(Titanium.Facebook.isLoggedIn());
    
    if(Titanium.Facebook.isLoggedIn()==false){
       ...
    }
    

    And it works but. it's a little cowboy codeing style :)

    — answered January 6th 2011 by Kasper Friis Christensen
    permalink
    1 Comment
    • Looks like this is going to change as of today's Webinar. New Facebook Graph API…

      — commented January 6th 2011 by Ryan Gartin
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.