Publish image on Facebook feed 'from iPhone app

I am using ASIHTTPRequest to work with the Facebook GUI.

This is the closest that I sent to publish pictures in the feed. Therefore if i have

ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];

URL https://graph.facebook.com/me/feed

Now, to post a snapshot, 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];

If you try this, then everything will work perfectly, except that the image will be sent. An empty place for an image is a feed display.

+3
source share
3 answers

Just use this small snippet to upload the image to disk as raw data

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

facebook: http://developers.facebook.com/docs/reference/api/post

, , api. , .

, facebook.com. , ​​ api.

+1

, ShareKit - http://www.getsharekit.com/

Facebook. , upload-then-publish .

,

0

Source: https://habr.com/ru/post/1752521/


All Articles