Loaded the module, added the tiapp.XML code with property.
alloy.js
Alloy.Globals.Facebook = require('facebook');index.js
// Don't forget to set your appid and requested permissions, else the login button // won't be effective. var fb = require('facebook'); fb.appid = XXXX_MYAPPID_XXX; fb.permissions = ['publish_stream']; fb.addEventListener('login', function(e) { if (e.success) { alert('Logged in'); fb.forceDialogAuth = true; } }); fb.addEventListener('logout', function(e) { alert('Logged out'); var url = 'https://login.facebook.com'; }); var url = 'https://login.facebook.com'; var client = Titanium.Network.createHTTPClient(); client.clearCookies(url); $.index.open();index.xml
<Alloy> <Window> <!-- Use the Alloy.Globals.Facebook namespace to create a Facebook module login button --> <LoginButton id="fbButton" ns="Alloy.Globals.Facebook"/> </Window> </Alloy>I receive that error from IOS simulator after the authentication on facebook:
'undefined' is not an object (evaluating 'fb.appid=0x57c53122ae285') at config.js (line 44)
What's the problem ? :(