Android的Facebook分享无法连接

时间:2014-07-13 21:18:16

标签: android facebook

我尝试使用facebook标准分享将我的应用分享添加到Facebook。共享对话框打开正确,但在我点击后,我得到一个

07-13 23:06:26.443: E/RaceActivity(11489): com.facebook.FacebookException: Error publishing message
07-13 23:06:26.443: E/RaceActivity(11489):  at com.facebook.internal.NativeProtocol.getErrorFromResult(NativeProtocol.java:434)
07-13 23:06:26.443: E/RaceActivity(11489):  at com.facebook.widget.FacebookDialog.handleActivityResult(FacebookDialog.java:343)
07-13 23:06:26.443: E/RaceActivity(11489):  at com.facebook.UiLifecycleHelper.handleFacebookDialogActivityResult(UiLifecycleHelper.java:282)
07-13 23:06:26.443: E/RaceActivity(11489):  at com.facebook.UiLifecycleHelper.onActivityResult(UiLifecycleHelper.java:150)
07-13 23:06:26.443: E/RaceActivity(11489):  at com.y2apps.therealrace.RaceActivity.onActivityResult(RaceActivity.java:795)
07-13 23:06:26.443: E/RaceActivity(11489):  at android.app.Activity.dispatchActivityResult(Activity.java:5322)
07-13 23:06:26.443: E/RaceActivity(11489):  at android.app.ActivityThread.deliverResults(ActivityThread.java:3491)
07-13 23:06:26.443: E/RaceActivity(11489):  at android.app.ActivityThread.handleSendResult(ActivityThread.java:3538)
07-13 23:06:26.443: E/RaceActivity(11489):  at android.app.ActivityThread.access$1100(ActivityThread.java:153)
07-13 23:06:26.443: E/RaceActivity(11489):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)
07-13 23:06:26.443: E/RaceActivity(11489):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-13 23:06:26.443: E/RaceActivity(11489):  at android.os.Looper.loop(Looper.java:137)
07-13 23:06:26.443: E/RaceActivity(11489):  at android.app.ActivityThread.main(ActivityThread.java:5289)
07-13 23:06:26.443: E/RaceActivity(11489):  at java.lang.reflect.Method.invokeNative(Native Method)
07-13 23:06:26.443: E/RaceActivity(11489):  at java.lang.reflect.Method.invoke(Method.java:525)
07-13 23:06:26.443: E/RaceActivity(11489):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
07-13 23:06:26.443: E/RaceActivity(11489):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)

之前我从Facebook获得以下错误(在加载facebook分享对话框期间)

07-13 22:55:32.815: W/fb4a(:<default>):BlueServiceQueue(10745): com.facebook.http.protocol.ApiException: (#100) Param third_party_app_id must be a valid application id


07-13 22:55:34.106: E/SpannableStringBuilder(10745): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

07-13 22:55:32.555: W/fb4a(:<default>):FbObjectMapper(10745): Falling back to Jackson for [simple type, class com.facebook.apptab.state.TabTag]

我按照facebook toutorial中关于UiLifecycleHelper设置的说明进行操作。我调用共享对话框的代码是

if (FacebookDialog.canPresentShareDialog(activity, FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) {
                FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(activity)
                .setName("NAME")
                .setDescription("Description")
                .setLink("https://www.google.com")
                .setApplicationName("AppName")
                .build();
                uiHelper.trackPendingDialogCall(shareDialog.present());

我运行了facebook示例HelloFacebook并且它有效(在我将eclipse调试哈希添加到我为它创建的facebook应用程序之后)。我还要提一下,我没有在facebook上签名。 谢谢。

1 个答案:

答案 0 :(得分:0)

我找到了答案。提示是Param third_party_app_id必须是打开对话框时打印的有效应用程序ID错误消息。问题是我在Google和Facebook上都使用app_id值,即使我在Facebook控制台中添加应用程序时Facebook创建了不同的应用程序ID。解决方案是区分两个id并使用Facebook id作为清单文件中的Facebook元数据标记。 我不确定为什么Facebook会让你继续对话,即使他们知道它会失败但是......