views:

593

answers:

4

I want to use the Facebook Graph API in a NATIVE iPhone Application. Has anybody been able to find a way to post images/message on a user's feed?

I have tried all possible ways to post a ‘picture’ (not a URL but a UIImage) on the feed and have been working on this for 2 weeks now.

If you go to facebook.com you can upload a picture from your computer on to the wall. 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];

The url is 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];

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.

A: 

This might get you started: http://www.capturetheconversation.com/technology/iphone-facebook-oauth2-graph-api

Jeremie Weldin
Thank you but I have already gone through this page. The problem is I am not able to get a way to post messages/pictures to facebook.
Minar
Messages should be as easy as using the code from the above tutorial to login, then using the access_token in a request to do the post as specified in the docs http://developers.facebook.com/docs/api#publishing
Jeremie Weldin
I appreciate your quick response. The problem is to post a image/message. Facebook is talking of curl in the link that you have given. curl it seems to be something related to PHP(I dont know much of PHP). I do not want to leave my app to do the processing. I wanted something that can work with NSURLRequest.
Minar
A: 

I'll be posting the second half of my tutorial (referenced above on Capture The Conversation http://capturetheconversation.com) next Tuesday (6/29) along with a pseudo API and the ability to post images to Facebook using the Graph API from an iTouch device.

Dominic

Dominic
You will be posting the images to the wall along with the message?
Minar
+1  A: 

Hi all....I've posted the second half of my tutorial...with a Facebook/iPhone pseudo-API you can roll into your own iPhone apps. Find iPhone, Facebook, oAuth 2.0 and the Graph API. A Tutorial, Part 2. here http://bit.ly/iPhoneFacebookTutorial

Happy Hacking, Dominic [email protected] @dominicdimarco

dominic
A: 

Hi all....I've posted the second half of my tutorial...with a Facebook/iPhone pseudo-API you can roll into your own iPhone apps. Find iPhone, Facebook, oAuth 2.0 and the Graph API. A Tutorial, Part 2. here http://bit.ly/iPhoneFacebookTutorial

Happy Hacking, Dominic [email protected] @dominicdimarco

dominic
Posting am image file in the feed fails. The request is:[variables setObject:@"test" forKey:@"message"]; //[variables setObject:@"http://bit.ly/bFTnqd" forKey:@"link"]; UIImage *picture = [UIImage imageNamed:@"75x75.png"]; FbGraphFile *graph_file = [[FbGraphFile alloc] initWithImage:picture]; [variables setObject:graph_file forKey:@"file"];[variables setObject:@"image" forKey:@"name"]; [variables setObject:@"boy." forKey:@"description"];This request fails. Posting an image via the "link" works.
Minar