使用 Facebook iPhone API 发布图像和文本的问题
我一直在尝试使用 Facebook iPhone API 从我的应用程序发布图像和一些文本(即使用 FBRequest call:@"facebook.stream.publish"
以及适当的参数)。
我发现这种行为非常不稳定,因为当我实现它时它首先工作正常,然后完全停止工作(请求将失败并且不会显示任何内容),现在有时仅发布文本,并且大多数时间仅以画廊风格发布图像(返回失败)。
我读到 Facebook 方面的问题,但是,我看到其他人的游戏定期发布带有图像和文本的内容,我想知道我是否可能在做一些根本不同的事情,这些事情不太可靠或稳定。有没有人遇到过这样的问题或者对此更熟悉?
I have been trying to use the Facebook iPhone API to publish an image and some text from my app (i.e. using FBRequest call:@"facebook.stream.publish"
with the appropriate params).
I've found that the behavior is extremely erratic, as it first worked fine when I implemented it, then, completely stopped working (the request would fail and nothing would show up), and now sometimes posts only the text and most of the time posts only the image in a gallery style (returning a failure).
I've read that it's something broken on Facebook's side, however, I see other people's games posting things periodically with images and text and wonder if I might be doing something fundamentally different that is much less reliable or stable. Has anyone encountered such an issue or has more familiarity with this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
看起来 Facebook 彻底搞砸了任何使用流发布来发布图像的人。他们似乎禁用了将您发送的图像放入帖子中的功能。请在 6 月 10 日附近检查此错误线程。
http://developers.facebook.com/show_bug.cgi?id=7345
除了自己托管图像之外,如果有人知道另一种方法来让这样的事情发挥作用,那么很高兴听到。
It looks like facebook royally screwed anyone who uses stream publish to get images posted. It appears they disabled the ability to put the image you send in your post. Check this bug thread near the June 10th timeframe.
http://developers.facebook.com/show_bug.cgi?id=7345
Short of hosting the image yourself, if anyone knows another way to get such a thing working, it'd be great to hear.
同样在这里,几天前我使用他们自己的 api 实现了基于 iPhone 的 Facebook 图像+文本共享,行为从看似正常变得不稳定和不可预测。
真正让我烦恼的是,在模拟器中它似乎总是有效。你也看到过这个吗?
(顺便说一句,我实际上并没有将图像上传到 Facebook,我只是发布带有我自己托管的图像链接的消息)
您最好坚持使用一个可以完全控制自己的简单后端。我在没有(稳定)iPhone api 的社交网络中使用的解决方案是将图像上传到后端,然后放入 UIWebView,让后端处理所有 OAuth 和发布内容。 UIWebView 会
在每次页面加载时回调您的应用程序,您可以使用它来确定请求是否失败、成功或进入等待状态。这是一种黑客行为,但它至少和你的后端一样可靠。
主要优点是
1)当 Facebook 出现问题时你可以修复它们
2) 有数百个经过验证的库可供使用
Same here, I implemented iphone based facebook image+text sharing using their own api a few days ago, and behavior went from seemingly ok to erratic and unpredictable.
What really annoys me, is that in the simulator it always seems to work. Have you seen this as well?
(btw I don't actually upload the image to facebook, I just publish the message with a link to the image hosted by myself)
You'd maybe better stick to a simple backend you can fully control yourself. The solution I use for social networks without a (stable) iphone api is to upload the image to my backend, and then just throw in a UIWebView, and let the backend handle all OAuth and publishing stuff. The UIWebView calls back on your app's
on every page load, which you could use to determine if the request failed, was a success, or entered a waiting state. It's kind of a hack but it is at least as reliable as your backend.
The main advantages are
1) you can fix things when facebook breaks them
2) there are 100s of proven libraries to use
更新:您可能需要添加到 FBStreamDialog.ma 检查 _session.apiKey 是否不为零。如果是,那么字典将保持为空,并且帖子将显示为空屏幕。
facebook 提供的示例代码确实:
参见 http://wiki.developers.facebook.com /index.php/Facebook_iPhone_SDK
FBDialog 的 init 随后会获取全局会话对象,但它显然偶尔会失败。
当您自己管理会话并使用:
一切正常。
UPDATE: You might want to add to FBStreamDialog.m a check if _session.apiKey is not nil. If it is, then the dictionary will remain empty, and the post will show up an empty screen.
The example code provided by facebook does:
see http://wiki.developers.facebook.com/index.php/Facebook_iPhone_SDK
FBDialog's init would then pick up the global session object, but it clearly fails occasionally.
When you manage the session yourself, and use:
Everything works ok.
Facebook API 和 SDK 之间存在一些混淆。
请参阅此答案,而不是
stream .publish
您打算使用feed
,但是当编写该答案时,您仍然必须使用stream.publish
,此后它可能已更新。希望我已经为您指明了正确的方向。There's a bit of confusion between the Facebook API and SDK.
See this answer, instead of
stream.publish
your meant to usefeed
, however when that answer was written you had to still usestream.publish
, it may have been updated since. Hopefully I've pointed you in the right direction.