宾德一直使用Facebook的Andr​​oid SDK中的时候敲定 [英] Binder has been finalized when using Facebook's Android SDK

查看:285
本文介绍了宾德一直使用Facebook的Andr​​oid SDK中的时候敲定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Facebook的为Android SDK(最新版本截至今日)。在code是验证如下:

I'm using Facebook's SDK for Android (latest version as of today). The code that is for authentication is the following:

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的应用程序打开时的请求,并显示正在加载...。几秒钟后,它就会消失,没有任何结果。

Unfortunately, the Facebook app opens upon that request and shows "Loading ...". A few seconds later, it just disappears without any result.

在LogCat中,我可以再读取以下异常:

In LogCat, I can then read the following exception:

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一个共同的问题?我不这么认为,还没有发现有关的事情。是什么原因导致这个问题?

Is this a common problem with Facebook SDK? I don't think so, haven't found anything about that. What causes this problem?

推荐答案

您应该确保您使用的是SDK 3.0(我们刚刚发布)的最终版本,可在的 https://developers.facebook.com/android

You should ensure you are using the final version of the SDK 3.0 (which we just released), available at https://developers.facebook.com/android

另外,还要确保你的Java 1.6和清洁工程/工作空间。

Also make sure you have Java 1.6 and a clean project/workspace.

我建议你使用现代模式的会话处理和登录,因为在该网站上的文档中描述的。

I'd advise you to use the contemporary patterns for Session handling and login, as described in the documentation on that site.

这篇关于宾德一直使用Facebook的Andr​​oid SDK中的时候敲定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆