简体   繁体   English

Android分享到Facebook无法连接

[英]Android share to facebook fails to connect

I'm trying to add to my app share to facebook using facebook standard share. 我正在尝试使用Facebook标准共享将我的应用共享添加到Facebook。 The share dialog opens correctly but then after I hit post I get an 共享对话框会正确打开,但是在我点击发布后,

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)

before it I get the following errors from facebook (during the load of the facebook share dialog) 在此之前,我从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]

I followed the instructions in the facebook toutorial in regards to the UiLifecycleHelper setup. 我遵循了Facebook教程中有关UiLifecycleHelper设置的说明。 My code to call the share dialog is 我调用共享对话框的代码是

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());

I ran the facebook sample HelloFacebook and it worked (after I added the eclipse debug hash to the facebook app I created for it). 我运行了Facebook示例HelloFacebook并成功了(将eclipse调试哈希值添加到为此创建的facebook应用程序中之后)。 I should also mention that I'm doing this without facebook signin. 我还要提到的是,我没有Facebook登录即可这样做。 Thank you. 谢谢。

I found the answer. 我找到了答案。 The hint was the Param third_party_app_id must be a valid application id error message that was printed when opening the dialog. 提示Param third_party_app_id必须是打开对话框时显示的有效应用程序ID错误消息。 The problem was that I was using app_id value for both Google and Facebook even though Facebook created a different app id when I added the app in the Facebook console. 问题是,即使我在Facebook控制台中添加应用程序ID时,Facebook创建了一个不同的应用程序ID,我仍在为Google和Facebook使用app_id值。 The solution was to differentiate the two id and use the Facebook id for the Facebook metadata tag in the manifest file. 解决方案是区分两个ID,并将清单ID用于清单文件中的Facebook元数据标签。 I'm not sure why Facebook lets you continue with the dialog even though they know it is going to fail but... 我不确定Facebook为什么让您继续对话,即使他们知道对话将失败,但是...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM