I follow the instructions listed at
http://docs.appcelerator.com/platform/latest/#!/api/Modules.Facebook
And look at the examples in the examples directory for Arrow / Users / Library / Application Support / Titanium/modules/commonjs/ti.cloud/3.2.10/example/windows/social/externalLogin.js
I have my Tiapp.xml configured as show instructions
<ios>
<plist>
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>my.org</string>
<string>my.application.id</string>
<key>CFBundleURLSchemes</key>
<array>
<string>my.org</string>
<string>fb(my.facebook.app.id)</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>(my.facebook.app.id)</string>
<key>FacebookDisplayName</key>
<string>my.org</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
</dict>
</plist>
</ios>
<modules>
<module platform="iphone">ti.map</module>
<module platform="iphone">facebook</module>
<module platform="commonjs">ti.cloud</module>
</modules>
<deployment-targets>
<target device="iphone">true</target>
</deployment-targets>
<sdk-version>5.2.0.GA</sdk-version>
my alloy view file looks like
<Alloy>
<Window id="social" class="container" navBarHidden="false" size="Ti.UI.FILL" title="" navTintColor="white" backButtonTitle="Event" barColor="black" onOpen="login">
<View backgroundColor="black" >
<LoginButton id="fbLogin" module="facebook" top="1%" height="7%" permissions="user_events"/>
</View>
</Window>
</Alloy>
my controller .js file looks like
var fb = require('facebook');
fb.readPermissions = ['read_stream','email','user_events'];
fb.appid = (my.facebook.app.id);
fb.forceDialogAuth = true;
function login (evt) {
fb.addEventListener('login', function(e) {
if (e.success) {
alert('Logged in');
}
});
fb.addEventListener('logout', function(e) {
alert('Logged out');
});
};
I get the Facebook login button as expected. But when I click on it, I just get the error message:
Not logged in: you are not logged in. Please log in and try again.
FB
Appcelerator Studio, : 4.5.0
Titanium SDK 5.2.0.GA
iPhone 6 Sim/Hardware iOS 9.2