login Method

This method logs the user into Facebook

intel.xdk.facebook.login(permissions);

Description:

This command is used to log the user into Facebook. When it is run, a dialog generated by Facebook should appear allowing the user to enter their credentials. Depending on the result of that interaction with Facebook, the application will receive a JavaScript event (intel.xdk.facebook.login) indicating whether the login was successful or not. This method will log the user in with a series of default permissions if no permissions parameter is specified.

Platforms:

Events:

  • intel.xdk.facebook.login: This event is fired upon completion of the interaction with Facebook and will indicate either successful login or failure.

Example:


alert("about to log into facebook");
document.addEventListener("intel.xdk.facebook.login",function(e){
        if (e.success == true) 
        { console.log("Facebook Log in Successful"); } 
        else 
        { console.log("Unsuccessful Login"); }
},false); 
intel.xdk.facebook.login("publish_stream,publish_actions,offline_access");                                
                                  
如需更全面地了解编译器优化,请参阅优化注意事项