I just downloaded the Facebook SDK for iOS because I need to be able to publish custom streams to user's Facebook feeds. The sample app has a method called publishStream:(id)sender that appears to set up a custom description for the Publish Stream dialog, but when my dialog comes up all I see is an empty dialog to start typing in. The code in the sample app is this:
`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];
[_app.facebook dialog:@"feed"
andParams:params
andDelegate:self];`
Should this code be populating a custom stream? If so, why isn't the demo project doing that for me? If not, what steps do I need to take in order to populate the stream with custom data?
Thanks for your help,
The sample app is a little outdated. Read up on Facebook's Feed Dialog documentation to see the properties you can set, and then, just do it like so:
NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
@"Share on Facebook", @"user_message_prompt",
@"http://www.yoursitehere.com/", @"link",
@"http://www.yoursitehere.com/thumbnail.jpg", @"picture",
nil];
[self.facebook dialog:@"feed" andParams:params andDelegate:self];