如何使用 iPhone 上存储的图像在 Facebook 上发布墙帖?
我有一个应用程序,我必须在 facebook 墙上发布图像。
现在的问题是我使用 GraphAPI facebook,我必须传递照片链接,但我的 iPhone 中有照片,而不是在任何服务器上。
那么如何在没有图像 URL 的情况下发布包含图像和其他参数的墙呢?
I have an application in which i have to post image on Wall of facebook.
Now problem is i used GraphAPI facebook and i have to pass link of photo but i have photo in my iPhone and not on any server.
So how do i post wall with image and other parameters without URL of image?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以使用 NSURLConnection ASIHttpRequest 库从 url 下载图像。
You may use NSURLConnection ASIHttpRequest library for downloading the images from a url.
编辑:
--
实际上,将图像发布到 Facebook 墙必须来自网络。所以你必须先上传图片;也许尝试使用 twitpic 之类的第 3 方服务,返回响应 URL 并将其放入您的参数中。
--
您可以使用以下命令将图像发布到 Facebook。您还可以将
UIImage
替换为物理 URL。它会是什么样子:
房子图标是从
[UIImage imageNamed:@"something .png"]
。Edit:
--
Actually, posting an image to the Facebook wall has to be from the web. So you will have to upload the image first; maybe try a 3rd party service like twitpic or something, return the response url and place it in your params.
--
You can use the following to post with image to Facebook. You can also replace
UIImage
with a physical URL as well.What it will look like:
The house icon is loaded from
[UIImage imageNamed:@"something.png"]
.我修改了 Facebook 演示应用程序。它使用模态视图从手机中选择图片。您可以使用此代码,前提是您必须添加两个按钮(即 selectPicture 按钮和 uploadPhoto 按钮)——还要确保添加到 .h 文件中的 UIViewController:
I modified the facebook demo app. It uses the modal view to select a picture from your phone. You can use this code, granted you must add two buttons (i.e., selectPicture button and a uploadPhoto button) -- also be sure to add to UIViewController in the .h file:
尝试使用 BMSocialShare 这是我编写的一个简单的库。它正是在做你想做的事。将一些本地图像(甚至打开一个对话框供用户添加评论)上传到用户墙上:
Try using BMSocialShare which is a simple lib I wrote. It is exactly doing what you want. Upload some local image (and even open a dialog for the user to add a comment) to the user's wall: