Frage

I implemented facebook login with Titanium(3.1.3) And Alloy.

But sometimes i'v this message Error when i try to login.

message = "FBSession: should only be used from a single thread";

War es hilfreich?

Lösung

in the SocialIntegrations call you must use your Facebook token after authorize

Alloy.Globals.Facebook = require('facebook');

    Alloy.Globals.Facebook.addEventListener('login', function(e) {
    if (e.success) {
        alert('Logged In' + JSON.stringify(e));
        Cloud.SocialIntegrations.externalAccountLogin({
            type : 'facebook',
            token : Alloy.Globals.Facebook.accessToken
        }, function(e) {
            if (e.success) {
                var user = e.users[0];
               // success
            } else {
                //error
            }
        });
    } else if (e.error) {
        alert(e.error);
    } else if (e.cancelled) {
        alert("Canceled");
    }
});

Andere Tipps

It would be easier to answer if you will post code which you use for Facebook integration.

You are probably calling some fb method just after fb.authorize(). Move all queries made to Facebook into event listener:

fb.addEventListener('login', function(event) {
  if (e.success) {
    /* your code */
  }
});

Also check out those resources from Appcelerator forum:

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top