目前我正在尝试在我的 Android 应用程序中实现 Facebook SDK。我按照官方教程进行操作,至少在我的 Galaxy S2 上是这样。我可以授权自己并将消息发布到我的墙上。但是当我在我的 Acer 平板电脑上尝试时,我得到了
11-19 11:15:54.160: W/System.err(7224): java.lang.UnsupportedOperationException: Session: an attempt was made to reauthorize a session that is not currently open.
11-19 11:15:54.160: W/System.err(7224): at com.facebook.Session.reauthorize(Session.java:1088)
11-19 11:15:54.160: W/System.err(7224): at com.facebook.Session.reauthorizeForPublish(Session.java:542)
11-19 11:15:54.160: W/System.err(7224): at de.lochmann.unnuetze.fakten.FacebookConnect.postToWall(FacebookConnect.java:199)
我的问题可能与android facebook sdk - Session: an attempt was made to reauthorize a session that has a pending request相关,但由于没有有效的答案,我想我会再试一次。
我的代码的重要部分:
if (session != null){
List<String> permissions = session.getPermissions();
if (!isSubsetOf(PERMISSIONS, permissions)) {
this.pendingPublishReauthorization = true;
Session.ReauthorizeRequest reauthRequest = new Session.ReauthorizeRequest((Activity) _ctx, PERMISSIONS).setRequestCode(REAUTH_ACTIVITY_CODE);
try {
session.reauthorizeForPublish(reauthRequest);
} catch(UnsupportedOperationException uoe) {
uoe.printStackTrace();
Toast.makeText(this._ctx, "Error, Reauthorization failed",Toast.LENGTH_LONG).show();
}
return;
}
etc...
}
你知道我错过了什么吗?在此先感谢,非常感谢任何帮助。