脸书应用程序有错误
Facebook app with error
我不是Facebook应用程序专家。我从FB网站上获取了此代码,并对其进行了修改,使其与我的应用程序ID一起使用(这是我唯一更改的内容。我也添加了一些警报)。然后我尝试从本地网页使用此代码(即:该页面在我的桌面上,但我的笔记本电脑已连接到互联网)。
每当我运行此代码时,我都会弹出一个浏览器弹出窗口,显示此错误:"MyAppName 出错。请稍后再试。
有人可以告诉我这里发生了什么吗?似乎FB.getLoginStatus也从未被调用过。
任何帮助,不胜感激。
// initialize the library with the API key
FB.init({ appId: 'myAppID',frictionlessRequests:true });
// fetch the status on load
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
// the user is logged in and has authenticated your
// app, and response.authResponse supplies
// the user's ID, a valid access token, a signed
// request, and the time the access token
// and signed request each expire
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
} else if (response.status === 'not_authorized') {
alert("1. not");
// the user is logged in to Facebook,
// but has not authenticated your app
} else {
alert("2. alert");
// the user isn't logged in to Facebook.
}
});
$('#login').bind('click', function() {
FB.login(handleSessionResponse);
});
$('#logout').bind('click', function() {
FB.logout(handleSessionResponse);
});
$('#disconnect').bind('click', function() {
FB.api({ method: 'Auth.revokeAuthorization' }, function(response) {
clearDisplay();
});
});
// no user, clear display
function clearDisplay() {
$('#user-info').hide('fast');
}
// handle a session response from any of the auth related calls
function handleSessionResponse(response) {
// if we dont have a session, just hide the user info
alert("entered handleSessionResponse");
if (response.authResponse) {
alert('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
alert('Good to see you, ' + response.name + '.');
});
} else {
alert('User cancelled login or did not fully authorize.');
}
if (!response.session) {
clearDisplay();
return;
}
}
您是否将属性myAppID
更改为您正在使用的Facebook应用程序的ID?
FB.init({ appId: 'myAppID',frictionlessRequests:true });
myAppID
应包含一个唯一的 Facebook 应用程序 ID,您可以在 Facebook 应用程序页面上获取该 ID。也许您只是复制了代码而没有更改它。
相关文章:
- 错误:$injector:modulerr模块错误(我的第一个SPA应用程序)
- 有没有一种方法可以从Javascript检测特定的应用程序是否安装在(AndroidiOS)设备上
- 动态代码中存在系统应用程序地址错误
- Rails第一个应用程序错误——Errno::ENOENT
- 是否有任何开源web应用程序具有良好的QUnit(或JSUnit)测试用例
- 如果文件不存在,fs.watch是否有错误处理程序
- Javascript 运行时错误:“应用程序未定义”
- 类型错误: 应用程序电缆未定义
- 未捕获的引用错误:应用程序未在 Angularjs 中定义
- 我有一个应用程序,我想在画布上生成 3D 模型,但我不知道要使用哪个工具
- 脸书应用程序有错误
- 如何在我的网页上为iPhone用户创建一个注释,说明有一个应用程序
- 我的代码是否有任何错误,不允许在关闭应用程序后在移动浏览器上保留cookie
- 引发错误应用程序
- 应用程序有错误.意外的标记."尝试添加删除按钮
- 是否有一个应用程序/服务允许您为AJAX请求创建远程数据库
- Redux表单不受应用程序管理,有奇怪的错误
- Phonegap - JNI错误(应用程序错误):本地引用表溢出(max=512)
- Facebook网页错误:应用程序可能无效
- 在angularjs中编写应用程序时,我有一个sintaxis错误