简体   繁体   English

iOS开发:如何在朋友的新闻Feed中显示Facebook墙贴?

[英]iOS Development: How can I get a Facebook wall post to show in the friend's news feed?

I'm integrating Facebook into my iPhone app and I have the code working to publish a post to the user's wall after they login, but I've noticed that the post doesn't show up in the user's news feed that's seen by the user's friends. 我正在将Facebook整合到我的iPhone应用程序中,并且我有代码在登录后将帖子发布到用户的墙上,但我注意到帖子没有显示在用户的新闻提要中。朋友。 Instead, it only shows up on the wall of the user. 相反,它只显示在用户的墙上。 Here's my code... 这是我的代码......

- (void)publishStream 
{
 NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
           @"Post a message on your wall",  @"user_message_prompt",
           @"Hello, World!", @"message",
           nil];

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

How can I have it show up in the news feed as well? 如何才能将它显示在新闻Feed中? I should mention that the only permission I have set is 'publish_stream' which, as I understand it, is the only permission I need. 我应该提一下,我设置的唯一权限是'publish_stream',据我所知,这是我需要的唯一权限。

Thanks so much for your wisdom! 非常感谢你的智慧!

You need to post to your friends feed, Easy way would be to adapt your code to use the appropriate graph method with the persons you wish to post to facebook ID (i've assumed here you have stored this from an earlier call the graph api in person.facebookID) 你需要发布给你的朋友提要,简单的方法是调整你的代码,使用适当的图表方法与你想发布到Facebook ID的人(我假设你已经存储了这个从早期的调用图表api in person.facebookID)

[facebook requestWithGraphPath:[NSString stringWithFormat:@"%@/feed/",person.facebookID] andParams:params andHttpMethod:@"POST" andDelegate:self

http://developers.facebook.com/docs/reference/api/post http://developers.facebook.com/docs/reference/api/post

To get a list of the users friends use the graph path me/friends 要获取用户列表,请使用图表路径me / friends

[facebook requestWithGraphPath:@"me/friends" andDelegate:self];

Which will return a JSON list of the users friends names and their Facebook ids, to the appropriate delegate method from FBRequest, its probably worth wrapping this set of results into a set of person objects or storing the returned NSDictionary so that you can retrieve individual friends, its upto you how you process the list of returned friends (you probably want to use a UITableView to display the user friends or filter based on some other input from the user) 这将返回用户朋友姓名及其Facebook ID的JSON列表到FBRequest的相应委托方法,它可能值得将这组结果包装到一组人物对象中或存储返回的NSDictionary,以便您可以检索个别朋友,它是你如何处理返回的朋友列表(你可能想使用UITableView显示用户朋友或基于用户的一些其他输入过滤)

Using this method will mean you do not have to use the Facebook dialogs in the iOS sdk, which does mean there is an upper limit to how many messages the user can post in a day using your app 使用此方法意味着您不必在iOS sdk中使用Facebook对话框,这意味着用户可以使用您的应用在一天内发布的消息数量有一个上限

If you wish to use a dialog you will need to include the "target_id" in your params dictionary and set this to the persons Facebook ID you wish to post to 如果您希望使用对话框,则需要在params字典中包含“target_id”,并将其设置为您要发布到的Facebook ID

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM