通过iPhone应用程序在Facebook“提要"上发布图片 [英] Posting picture on Facebook 'feed' from an iPhone app

查看:82
本文介绍了通过iPhone应用程序在Facebook“提要"上发布图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ASIHTTPRequest来处理Facebook图形API.

I am using ASIHTTPRequest to work on Facebook graph API.

这是我最近在提要上发布图片的位置.因此,如果我有

This is the nearest I have gone to posting a picture on the feed. So if I have a

ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];

网址为 https://graph.facebook.com/me/feed

现在要发布图片,我将执行以下操作:

Now to post a picture I do the following:

[request setPostValue:@"My Message" forKey:@"message"];

[request setPostValue:@"somepic.png" forKey:@"picture"];

[request setPostValue:@"Some Name" forKey:@"name"];

[request setPostValue:@"Some description" forKey:@"description];

[request startAsynchronous];

如果您尝试此操作,则除了所发布的图片之外,其他所有功能都可以正常工作. Feed上会显示图片的空白占位符.

If you try this then everything works fine other than the picture being posted. A blank placeholder for the picture is though show on the feed.

推荐答案

只需使用此小片段将图像作为原始数据上传到磁盘上

Just use this small snippet to upload a image on your disk as raw data

ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setData:UIImageJPEGRepresentation(img.image, 0.1) withFileName:filename andContentType:@"image/jpeg" forKey:@"photo"];

这篇关于通过iPhone应用程序在Facebook“提要"上发布图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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