Facebook Connect iPhone custom publish stream

青春壹個敷衍的年華 提交于 2019-12-06 04:06:00

问题


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,


回答1:


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];



回答2:


@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;



来源:https://stackoverflow.com/questions/5124197/facebook-connect-iphone-custom-publish-stream

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!