user1385666
user1385666

Reputation: 357

post on face book's wall complex message programmatically using iPhone sdk

I've just solved the problem with posting on facebook's wall programmatically using Facebook iOS sdk. It is completely working in my application. Here's the part of code:

NSString *messageString=@"test message";
FBRequest *request=[[FBRequest alloc] initWithSession:FBSession.activeSession graphPath:@"me/feed" parameters:[NSDictionary dictionaryWithObject:messageString forKey:@"message"] HTTPMethod:@"POST"];

Now I need to post not only the text message on facebook's wall. I need to post this: post on Facebook example

Here are the parameters which I should use to make my post look similar http://developers.facebook.com/docs/reference/rest/stream.publish/

Help me please to make tether values with parameters (message, link, caption etc.).

The very best answer would be NSDictionaryobject which I can pass to my FBRequestinit method as a parameters argument.

Thanks you for your attention.

Upvotes: 0

Views: 871

Answers (1)

Ryan Poolos
Ryan Poolos

Reputation: 18551

This is the code I use to post to Facebook for something very much like your picture.

SBJSON *jsonWriter = [SBJSON new];

NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
                            attachmentTitle, @"name",
                            attachmentLink, @"href",
                            attachmentCaption, @"caption",
                            attachmentDescription, @"description",
                            nil];

NSString *attachmentStr = [jsonWriter stringWithObject:attachment];

[postContent setObject:attachmentStr forKey:@"attachment"];       
[postContent setObject:textView.text forKey:@"message"];

[FB requestWithMethodName:@"stream.publish" andParams:postContent andHttpMethod:@"POST" andDelegate:self];

Upvotes: 1

Related Questions