我正在尝试使用Open Graph在我的应用程序中打开一个共享对话框,它会正常打开但几秒钟后崩溃。
我的代码遵循https://developers.facebook.com/docs/android/share-dialog/#publish-og-with-user-objects的文档,但createForPost的构造函数稍有不同,尽管我尝试了两种方法。
private void shareToFB(Context context) {
if (FacebookDialog.canPresentOpenGraphActionDialog(context.getApplicationContext(),
FacebookDialog.OpenGraphActionDialogFeature.OG_ACTION_DIALOG)) {
OpenGraphObject badge = OpenGraphObject.Factory.createForPost
(OpenGraphObject.class, "exercisemeapp:badge", "I earned a new badge!",
"http://4sqday16.files.wordpress.com/2011/11/foursquare-gym-rat-badge.png",
null, "I completed a full body workout for 7 straight days!");
OpenGraphAction action = GraphObject.Factory.create(OpenGraphAction.class);
action.setProperty("badge", badge);
action.setType("exercisemeapp:earn");
FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(getActivity(), action, "badge")
.build();
uiHelper.trackPendingDialogCall(shareDialog.present());
} else {
Toast.makeText(getActivity(), "Facebook not available", Toast.LENGTH_SHORT).show();
}
}
我在logcat中看到的唯一错误如下:
1525-1525/com.facebook.katana E/dalvikvm﹕ Could not find class 'org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl', referenced from method com.facebook.ssl.openssl.check.CheckOpenSSLImplHasRequiredMethods.<clinit>
1525-1525/com.facebook.katana E/dalvikvm﹕ Could not find class 'org.apache.harmony.xnet.provider.jsse.OpenSSLSocketFactoryImpl', referenced from method com.facebook.ssl.openssl.reflect.SSLParametersGetter.<clinit>
1525-1525/com.facebook.katana E/dalvikvm﹕ Could not find class 'org.apache.harmony.xnet.provider.jsse.SSLParametersImpl', referenced from method com.facebook.ssl.openssl.reflect.SSLParametersGetter.a
1525-1525/com.facebook.katana E/dalvikvm﹕ Could not find class 'org.apache.harmony.xnet.provider.jsse.SSLParametersImpl', referenced from method com.facebook.ssl.openssl.reflect.SSLSessionTimeoutSetter.<clinit>
1525-1525/com.facebook.katana E/dalvikvm﹕ Could not find class 'org.apache.harmony.xnet.provider.jsse.ClientSessionContext', referenced from method com.facebook.ssl.openssl.reflect.SSLSessionTimeoutSetter.a
1525-1525/com.facebook.katana E/dalvikvm﹕ Could not find class 'com.facebook.ssl.openssl.TicketEnabledOpenSSLSocketImplWrapper', referenced from method com.facebook.ssl.openssl.TicketEnabledOpenSSLSocketFactoryHelper.a
警告:
Exception during service com.facebook.http.protocol.ApiException:
(#404) Key hash bMpkGAEDBrEt9w9JMM_UU5Jx-Cc does not match any stored key hashes.
at com.facebook.http.protocol.ApiResponseChecker.b(ApiResponseChecker.java:103)
答案 0 :(得分:0)
看起来您的应用的哈希密钥和在facebook上注册的密钥不匹配。这就是facebook says。
您要创建的每个Android应用都会被签名,您需要在Facebook上注册每个应用的密钥哈希作为真实性的安全检查