0
我試圖用Open Graph在我的應用程序內部打開一個共享對話框,它會正常打開,但幾秒鐘後崩潰。Android - Facebook打開圖片共享對話框打開,然後崩潰
我的代碼遵循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)
你有沒有正確設置你的應用程序的關鍵?請參閱https://developers.facebook.com/docs/android/getting-started/ – Srikanth
的最後一節,這是問題所在,謝謝! –