fb.authorize() 从不提供登录事件 [英] fb.authorize() never give a login event
本文介绍了fb.authorize() 从不提供登录事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 appcelerator 文档中的代码,如下所示:
I am using the code from the appcelerator docs like this:
var fb = require('facebook');
fb.addEventListener('login', function(e) {
Ti.API.info("Login event received...");
if (e.success) {
alert('login from uid: '+e.uid+', name: '+ JSON.parse(e.data).name);
}
else if (e.cancelled) {
// user cancelled
alert('cancelled');
}
else {
alert(e.error);
}
});
Ti.API.info("fb authorize...");
fb.permissions = ['public_profile'];
fb.initialize();
fb.authorize();
但登录事件永远不会被触发,也没有任何反应.有人知道为什么吗?
But the login event is never fired and nothing happens. Anyone have any idea why?
我在 iPhone 上使用 appcelerator studio 5.2.2.GA 和 iOS 9.3.1.
I am using appcelerator studio 5.2.2.GA and iOS 9.3.1 on iPhone.
推荐答案
请阅读 额外的 iOS 设置步骤 并初始化模块:
Please read Additional iOS Setup Steps and initialize module:
var fb = require('facebook');
fb.permissions = [FACEBOOK_APP_PERMISSIONS];
fb.initialize();
fb.authorize()
这篇关于fb.authorize() 从不提供登录事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文