我使用Facebook的Android的SDK(最新版本为今天)。 这是用于身份验证的代码如下:
prefs = PreferenceManager.getDefaultSharedPreferences(this);
facebook = new Facebook(FACEBOOK_APP_ID);
String fbAccessToken = prefs.getString("fb_access_token", null);
long fbAccessExpires = prefs.getLong("fb_access_expires", 0);
if (fbAccessToken != null) {
facebook.setAccessToken(fbAccessToken);
}
if (fbAccessExpires != 0) {
facebook.setAccessExpires(fbAccessExpires);
}
if (!facebook.isSessionValid()) {
facebook.authorize(this, new String[] { "friends_birthday" }, new DialogListener() {
public void onComplete(Bundle values) {
SharedPreferences.Editor prefEditor = prefs.edit();
prefEditor.putString("fb_access_token", facebook.getAccessToken());
prefEditor.putLong("fb_access_expires", facebook.getAccessExpires());
prefEditor.commit();
// do some graph requests
}
public void onFacebookError(FacebookError error) {
}
public void onError(DialogError e) {
}
public void onCancel() {
}
});
}
else {
// do some graph requests
}
不幸的是,Facebook的应用程序打开时该请求,并显示“正在加载...”。 几秒钟后,它就会消失,没有任何结果。
在logcat的,然后我就可以读出以下异常:
12-11 21:04:34.597: E/System(29584): Uncaught exception thrown by finalizer
12-11 21:04:34.613: E/System(29584): java.lang.IllegalStateException: Binder has been finalized!
12-11 21:04:34.613: E/System(29584): at android.os.BinderProxy.transact(Native Method)
12-11 21:04:34.613: E/System(29584): at android.database.BulkCursorProxy.close(BulkCursorNative.java:288)
12-11 21:04:34.613: E/System(29584): at android.database.BulkCursorToCursorAdaptor.close(BulkCursorToCursorAdaptor.java:133)
12-11 21:04:34.613: E/System(29584): at android.database.CursorWrapper.close(CursorWrapper.java:49)
12-11 21:04:34.613: E/System(29584): at android.content.ContentResolver$CursorWrapperInner.close(ContentResolver.java:1591)
12-11 21:04:34.613: E/System(29584): at android.content.ContentResolver$CursorWrapperInner.finalize(ContentResolver.java:1604)
12-11 21:04:34.613: E/System(29584): at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:182)
12-11 21:04:34.613: E/System(29584): at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:168)
12-11 21:04:34.613: E/System(29584): at java.lang.Thread.run(Thread.java:856)
这是与Facebook SDK一个共同的问题? 我不这么认为,还没有发现有关的事情。 是什么原因导致这个问题?