简体   繁体   English

Api Facebook iPhone,可以发布到朋友的墙上

[英]Api Facebook iphone , possible to post to a friend's wall

I want to know if it is possible to post to a friend's wall using the iPhone Facebook api. 我想知道是否可以使用iPhone Facebook API将其发布到朋友的墙上。 I have already links explaining how to post on user'wall but not on firend's wall here are the links : 我已经有链接说明如何在user'wall上发帖,而不是在firend的墙上发贴,这些是链接:

http://www.raywenderlich.com/tag/facebook http://www.raywenderlich.com/tag/facebook

You just have to send your friend's Facebook ID as a parameter under the key "target_id". 您只需要在键“ target_id”下发送朋友的Facebook ID作为参数即可。

OLD SDK: set the FBStream dialog's targetId property. OLD SDK:设置FBStream对话框的targetId属性。

NEW SDK: set a parameter under the key @"target_id" on the parameters dictionary (when invoking dialog:andParams:andDelegate: on the Facebook object). 新SDK:在参数字典上的键@“ target_id”下设置参数(在Facebook对象上调用dialog:andParams:andDelegate:时)。

Here you have a sample post using the new sdk (the one that uses graph api): 在这里,您有一个使用新sdk(使用graph api的)的示例帖子:

NSMutableDictionary* params = [NSMutableDictionary dictionary];
[params setObject:@"Some text" forKey:@"user_message_prompt"];
[params setObject:@"another text" forKey:@"action_links"];
[params setObject:@"Yet another text" forKey:@"attachment"];
[params setObject:@"SOME FACEBOOK ID" forKey:@"target_id"];

//At some point you need to create the following Facebook instance

[facebook dialog: @"stream.publish"
    andParams: params
    andDelegate: self];

I haven't actually tested this code, but this is a pretty straight-forward thing to once you have already posted a message to your wall. 我实际上尚未测试过此代码,但是一旦您已经在墙上张贴了一条消息,这就是一件很简单的事情。

Hope this helps. 希望这可以帮助。 Cheers! 干杯!

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

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