Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook iOS SDK Dialog parameters

Tags:

This is probably a n00b question, but nontheless... I have a bit of a problem using the Facebook SDK in my iPad app: when I display a dialog using [facebook dialog:@"feed" andDelegate:self]; I don't see any way I can change the title, the content or the URL of what I want to share.

In their Demo App, Facebook has the following code:

- (IBAction)publishStream:(id)sender {

  SBJSON *jsonWriter = [[SBJSON new] autorelease];

  NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary 
  dictionaryWithObjectsAndKeys: @"Always Running",@"text",@"http://itsti.me/",
                                @"href", nil], nil];

  NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
  NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
                               @"a long run", @"name",
                               @"The Facebook Running app", @"caption",
                               @"it is fun", @"description",
                               @"http://itsti.me/", @"href", nil];
  NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
  NSMutableDictionary* params = [NSMutableDictionary
                                 dictionaryWithObjectsAndKeys:
                                 @"Share on Facebook",  @"user_message_prompt",
                                 actionLinksStr, @"action_links",
                                 attachmentStr, @"attachment",
                                 nil];


  [_facebook dialog:@"feed"
          andParams:params
        andDelegate:self];

}

However, when I press the publishStream button, none of those strings shows on the dialog! :S

Is there something I'm not doing right? all I changed in that Demo App was the Facebook kAppId and the URL Scheme.

like image 369
The WebMacheter Avatar asked Jan 05 '11 23:01

The WebMacheter


1 Answers

I realized this is already answered, but I found this to be the correct answer. It follows what FB has here. The image and/or link actually shows up in the dialog. stream.publish didn't make that change for me. Also, the dialog page says that the stream.publish is old.

NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               @"http://developers.facebook.com/docs/reference/dialogs/", @"link",
                               @"http://fbrell.com/f8.jpg", @"picture",
                               @"Facebook Dialogs", @"name",
                               @"Reference Documentation", @"caption",
                               @"Dialogs provide a simple, consistent interface for apps to interact with users.", @"description",
                               @"Facebook Dialogs are so easy!",  @"message",
                               nil];


[_facebook dialog:@"feed"
        andParams:params
      andDelegate:self];
like image 146
Mr Rogers Avatar answered Oct 04 '22 02:10

Mr Rogers