【发布时间】:2011-09-06 00:47:57
【问题描述】:
我正在尝试将图片和文字发布到朋友的墙上。我不应该使用对话框,我使用 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];
【问题讨论】:
标签: iphone ios facebook ios4 facebook-graph-api