使用 Facebook iOS SDK 在用户的墙上发布照片 [英] Post photo on user's wall using Facebook iOS SDK

查看:24
本文介绍了使用 Facebook iOS SDK 在用户的墙上发布照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将相机中的照片上传到用户的 Facebook 墙上.我不完全确定正确的策略是什么,但从阅读周围来看,似乎要做的事情是将照片上传到相册,然后有人在墙上张贴该相册/照片的链接.理想情况下,这将涉及对话,但据我所知这是不可能的.

I'm trying to upload a photo from the camera to a user's Facebook wall. I'm not entirely sure what the correct strategy is, but from reading around it seems the thing to do is upload the photo to an album, and then someone post on the wall a link to that album/photo. Ideally this would involve the dialog, but from what I can tell that's not possible.

我已成功将照片上传到相册,并取回了该照片的 ID,但我不确定之后该怎么做.

I've managed to upload a photo to an album, and get back an ID for that photo, but I'm not sure what to do after that.

谁能提供一些简单的代码来实现这一点?

Can anyone provide some straightforward code for achieving this?

额外问题:是否可以将照片也(或改为)发布到应用程序墙?

Bonus question: Is it possible to post the photo to the application wall, as well (or instead)?

Graph API 更可取,但在此阶段工作的任何东西都很好.

Graph API is preferable, but anything that works at this stage is good.

推荐答案

更清楚你想要做什么 - 将照片发布到 FB,并保证帖子会出现在用户的墙上/信息流上.

It's clearer what you wish to do - post a photo to FB, and guarantee that a post goes on the user's wall/stream.

不幸的是,有一些事情阻碍了.

Unfortunately, there are some things in the way.

FB Graph API 似乎只允许您将图片发布到相册,或直接发布到墙上,链接到网络上某处已存在的图片.在第一种情况下,可能会在流中发布一个帖子,但 FB 似乎以某种方式合并多个帖子,以防止用户的流被轰炸.在我能看到的任何地方都没有记录此机制.

FB Graph API appears to only allow you to post EITHER a picture to an album, or post to the wall directly, linking to a picture already existing somewhere on the web. In the first case, a post in the stream will probably be made, but FB appears to consolidate multiple posts in some manner so as to keep the user's stream from being bombarded. The mechanism for this is not documented anywhere I could see.

在第二种情况下,您可能认为发布到相册,然后明确发布到相册的链接可以侥幸成功.您可以向原始专辑帖子no_story"添加一个值为 1 的参数,并在您准备制作显式帖子时抑制可能制作的墙贴.但是,FB 暂时不会有新发布图像的源 URL,并且它似乎不喜欢包含其自己的内容交付网络的 URL,从而返回错误.您可能会想简单地将状态更新放入流中,谈论帖子,但是,Graph API 也仅限于每个应用每天 25 个这样的直接提要帖子,以防止垃圾邮件.

In the second case, you might think you could get away with posting to an album, and then explicitly posting a link to the album. You can add a parameter to the original album post, "no_story" with a value of 1, and suppress the wall post that might be made while you prepare to make an explicit one. However, FB will not have the source URL for a newly posted image for a while, AND, it doesn't appear to like URLs that include its own content delivery network, returning an error. You might think to simply put status update in the stream, talking about the post, However, the Graph API is also limited to 25 such direct feed posts per day per app, to prevent spamming.

一种解决方案是发布到诸如 Flickr 之类的东西,获取图像的 URL,然后发布到墙上.FB 的首选解决方案似乎是使用作为移动工具包一部分的 FB 对话框——本质上是类似于 OAuth 屏幕的小网页.

One solution would be to post to something like Flickr, get the URL of the image, and then post to the wall. FB's preferred solution appears to be to use the FB dialogs that are part of the mobile toolkit - essentially little web pages much like the OAuth screen.

就我个人而言,我打算像上面一样简单地发布到相册,并接受 FB 的关于如何通知用户的想法.好奇你选择如何继续.

Personally, I plan to simply post to the album as above, and live with FB's idea of how the user should be notified. Curious how you choose to proceed.

这篇关于使用 Facebook iOS SDK 在用户的墙上发布照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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