问题描述
我有iframe facebook应用,但重新加载后陷入无限循环.
I have iframe facebook app but reload making infinite loop.
昨天工作正常,但不是今天.
Yesterday work fine, but not to day.
我正在将javascript和php sdk 3.1.1与以下代码一起使用:
I'm using javascript and php sdk 3.1.1 with this code:
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
oauth: true, // turn oauth
appId : 'myappId',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.Canvas.setAutoGrow();
</script>
FB.getLoginStatus(function(response) {
if (response.session) {
var query = FB.Data.query('select publish_stream from permissions where uid={0}', response.authResponse.userID);
........................
}
}
如果我删除"<script src="http://connect.facebook.net/en_US/all.js"></script>"
行,它不会无限循环,但是应用程序无法像我想要的那样工作.
If I delete "<script src="http://connect.facebook.net/en_US/all.js"></script>"
line, it does not infinite loop, but the app not work like i want.
推荐答案
Facebook迁移了JavaScript SDK以支持OAuth2,并要求所有应用必须在2011年10月1日之前迁移到OAuth 2.0(但最后一次是2011年12月14日). ,我更改:
Facebook migrated JavaScript SDK to support OAuth2, and requiere that all apps must migrate to OAuth 2.0 by October 1, 2011 (but last time was december 14 2011) therefore, I change:
FB.getLoginStatus(function(response) {
if (response.session) {
........................
}
作者
FB.getLoginStatus(function(response) {
if (response.authResponse) {
........................
}
因为该应用是在启用OAuth 2.0的情况下初始化的.
because the app was initialized with OAuth 2.0 enabled.
案件已结案.
这篇关于我的Facebook应用程序在SDK 3.1.1中进行无限循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!