[TIMOB-23182] Facebook login is not working on iOS
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2016-04-10T18:53:56.000+0000 |
Affected Version/s | Release 5.2.2 |
Fix Version/s | n/a |
Components | iOS |
Labels | facebook, ios, login |
Reporter | Mostafizur Rahman |
Assignee | Chee Kiat Ng |
Created | 2016-04-08T19:03:01.000+0000 |
Updated | 2016-04-10T18:53:56.000+0000 |
Description
Facebook login is not working on latest SDK.
*Testing Environment:*
Titanium SDK: 5.2.2.GA
Appcelerator Command-Line Interface, version 5.2.2
Facebook module version: 5.0.1
Testing device: iPod 5G(9.2)
*Testing Code:*
var fb = require('facebook');
var win = Ti.UI.createWindow({
title : 'Login/Logout',
backgroundColor : '#fff',
});
var label = Ti.UI.createLabel({
text : 'Logged In = ' + fb.loggedIn,
color : '#000',
font : {
fontSize : 20
},
top : 10,
textAlign : 'center'
});
win.add(label);
fb.addEventListener('login', function(e) {
if (e.success) {
alert('login from uid: ' + e.uid + ', name: ' + JSON.parse(e.data).name);
label.text = 'Logged In = ' + fb.loggedIn;
} else if (e.cancelled) {
// user cancelled
alert('cancelled');
} else {
alert(e.error);
}
});
fb.authorize();
fb.addEventListener('logout', function(e) {
alert('logged out');
label.text = 'Logged In = ' + fb.loggedIn;
});
var loginButton = fb.createLoginButton({
readPermissions : ['email'],
top : 100,
width : 150,
height : 100
});
win.add(loginButton);
win.open();
*Testing Result:*
Facebook login not working and login dialog not appear for IOS.
Hello, I have tested the issue in iOS simulator and device with SDK 5.2.1.GA, 5.2.2.GA. I couldn't reproduce the issue. Facebook Login is working as expected. Use the below code instead. Facebook module Version 5.1.0
I have added this additional code. This is required after you set up login/logout listeners and permissions
Regards, Sharif.