Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Connect iPhone custom publish stream

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,

like image 969
SSS Avatar asked Dec 28 '22 00:12

SSS


2 Answers

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];
like image 116
Simon Goldeen Avatar answered Jan 08 '23 11:01

Simon Goldeen


@Mahmud: Well facebook automatically generates feeds of your friends to show your home feed section; Once you post on your wall, the home screen of your friends will get your post as per the algorithm that facebook used for populating one's home feed; Might be your feed doesn't get top postion in home feed items but it will be definitely there .... after 4 5 posts;

like image 32
Ans Avatar answered Jan 08 '23 10:01

Ans