繁体   English   中英

如何在朋友的墙上张贴图片和文字

[英]How to Post An Image+ Text on friend's wall

我正在尝试将图像和文本发布到朋友的墙上。 我不应该使用对话框,而是使用stream.publish直接发布。 我可以成功地将其发布到我自己的墙上(登录的用户),但是我需要找到一种在朋友的墙上发布的方法。

这是我的代码,我需要有人帮助我添加几行代码以发布到朋友的墙。

/*
Friends URL To whom's wall I need to post. 
 **I need to figure out how to use friendURL in my code. 
So that post goes to my    friend's wall.
Below code is posting to my own  wall.**

*/ 
NSString *friendURL = [NSString stringWithFormat:
                              @"http://www.facebook.com/profile.php?id=%@",
                              marriedFriend.userID];
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 by Rahul...", @"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];



[facebookRef  requestWithMethodName:@"stream.publish" andParams:params andHttpMethod:@"POST" andDelegate:self];

您似乎正在使用旧的API。 使用更新的Graph API,您可以执行以下操作:

// replace PROFILE_ID with your friend's ID
[facebookRef requestWithGraphPath:@"PROFILE_ID/feed" andParams:params andHttpMethod:@"POST" andDelegate:self];

在此处查看更多文档。

暂无
暂无

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

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