Facebook FB.ui 发送对话框间歇性地返回无效链接错误 [英] Facebook FB.ui send dialog intermittently returns invalid link error

查看:23
本文介绍了Facebook FB.ui 发送对话框间歇性地返回无效链接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这已经运行了一个多星期了.

This has been working fine for over a week.

FB.ui({
  method: 'send',
  to: connectionid,
  name: subject,
  picture: staticurl + 'images/logoformysite.png',
  link: homeurl + '/' + username + '/something=' + var1 +'&somethingelse=' + encodeURI(var2) + '&evenmore=' + encodeURI(var3),
  description: invitemessage,
});

上周我最初遇到一个错误,如果 URL 在 Facebook 域内,Facebook 会阻止它.我解决了这个问题,现在图片和链接都不属于 Facebook 域,而是来自我的网站.但这从今天开始发生,没有任何改变.它是间歇性的.

I had initially had an error last week where if the URL was within the Facebook domain, Facebook would block it. I fixed that and now both the picture and the link do not belong to the Facebook domain and come from my site. But this started happening today with nothing changed. It is intermittent.

An error occurred. Please try again later.

API Error Code: 100 API Error Description: Invalid parameter Error Message: 'link' is invalid.

即使我将它发送给同一个用户,也不清楚为什么它有时会起作用,而有时却不起作用.想知道我是否错过了一个公告.但我希望它至少会一直失败,但事实并非如此.

It is not clear why it works sometimes and not other times even if I am sending it to the same user. Wondering if I missed an announcement. But I would hope that it would at least fail consistently but that is not the case.

更新:我不确定如何在页面上全局设置我在对话框中设置的链接.它将向消息的收件人发送错误的链接.看看上面的例子如何在新的开放图世界中工作会非常有帮助.

UPDATE: I am not sure how the link I am setting in the dialog can be set globally on the page. It will send the recipients of the message the wrong link. It would be really helpful to see an example of how the above would work in the new open graph world.

回答 2013 年 8 月 12 日

问题围绕着我们的 url 是动态的,每次都需要强制缓存.我现在对 "https://developers.facebook.com/tools/debug 进行 ajax 调用/og/object" 来刷新它,然后启动发送对话框.

The issue revolved around our url being dynamic and needing force caching each time. I now make an ajax call to "https://developers.facebook.com/tools/debug/og/object" to refresh it and then launch the send dialog.

推荐答案

我遇到了同样的问题,从上周开始就停止工作了.

I had the same issue and that stopped working since last week.

这是我的解决方案:

转到 Facebook 调试器并添加您的 URL.点击调试"并修复 Facebook 显示的所有警告.

Go to Facebook debugger and add your URL. Click on "Debug" and fix all warnings displayed by Facebook.

为了修复我的问题,我必须在我的页面中添加 og.url 元标记.该值应与您要共享的值完全相同(无重定向).然后 Facebook 向我发送了此通知(警报):

To fix mine I had to add the og.url meta tag in my page. The value should be exactly the same as the one you want to share (no redirection). Then Facebook sent me this notification (alert):

您的应用 XXX 现在符合流帖子 URL安全迁移.无需采取进一步措施.

Your app, XXX, is now compliant with the Stream post URL security migration. No further action is required.

再次尝试与 FB.ui 分享您的链接,现在您的帖子应该会自动显示您的 og 值.

Try to share your link with FB.ui once again and now your post should automatically display your og values.

注意:Facebook 10 月重大变更 将自动使用那些 og 元数据而不是自定义 FB.ui 参数,因此您现在可以激活重大更改以准备好并从代码中删除名称/图片/描述.

Note: Facebook October breaking change will automatically use those og metas instead of custom FB.ui parameters, therefore you can now activate the breaking change to get ready and remove name/picture/description from your code.

更新:即使我上面提到的正确实施,这个问题也会再次发生.

UPDATE: This problem can happens again even if what I mentioned above is correctly implemented.

如果这是您的情况,那是因为您必须强制 Facebook抓取"您的页面.当您使用 Facebook 对象调试器或将链接复制/粘贴到时间线/私人消息上时,此过程由 Facebook 自动完成.如果您使用 JavaScript SDK,则必须要求 Facebook 将您的页面编入索引和缓存.

If it is your case that's because you have to enforce Facebook to "scrape" your page. This process is automatically done by Facebook when you use the Facebook object debugger or you copy/paste your link on your timeline / private messages. If you use the JavaScript SDK you have to ask Facebook to index and cache your page.

你不会在与 JavaScript SDK 相关的 Facebook 文档中找到这个(或者你很幸运),所以为了节省你所有的时间,我发现这个令人难以置信的问题(记住 Facebook 只说你的链接无效)你可以在此页面上找到更多详细信息.

You won't find this in the Facebook documentation related to the JavaScript SDK (or you are lucky) so to save you all the days I lost to find this unbelievable issue (remember Facebook only said your link is invalid) you can find more details on this page.

我尝试使用 Graph API 强制 Facebook 抓取我新创建的页面,如果它对您有用,那么您很幸运.未提及但产生相同结果的第二种方法是向 Facebook 对象调试器页面发送请求,并在 URL 中添加您的页面链接(例如 https://developers.facebook.com/tools/debug/og/object?q=YourPageUrlHere).通过这样做,Facebook 这次将抓取您的页面,现在您可以使用 Facebook API 共享您的链接,现在一切正常.

I tried to use the Graph API to enforce my newly created page to be scraped by Facebook, if it works for you you are lucky. The second method which is not mentionned but produced the same result is to send a request to the Facebook Object Debugger page and add your page link in the URL (e.g. https://developers.facebook.com/tools/debug/og/object?q=YourPageUrlHere). By doing this Facebook will this time scrape your page and now you can share your links with the Facebook API, everything is now working.

这篇关于Facebook FB.ui 发送对话框间歇性地返回无效链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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