Facebook API:发布在朋友的墙上

时间:2012-05-27 09:47:19

标签: iphone ios facebook facebook-graph-api

是否可以在用户朋友的墙上发布内容,而无需先让所有朋友(所以你可以获得好友ID)?

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

2 个答案:

答案 0 :(得分:3)

您可以通过向me/friends发出请求来获取登录用户的朋友 然后你可以创建一个显示朋友列表的ui元素,用户可以选择他想与之分享的元素。

然后,在用户选择后,您只需在FRIEND_ID/feed publish_streamFeed connection of the User object)发布POST即可在其墙上发帖。
您需要拥有Enables your app to post content, comments, and likes to a user's stream and to the streams of the user's friends权限才能:{{1}}(http://developers.facebook.com/docs/authentication/permissions/)

答案 1 :(得分:3)

见这个

-(IBAction)PostToBuddyWall
{

NSMutableDictionary  *postVariablesDictionary = [[NSMutableDictionary alloc] init];


[postVariablesDictionary setObject:@"LOL" forKey:@"name"];    
[postVariablesDictionary setObject:self.postTextView.text forKey:@"message"];


[objDelegate.facebook requestWithGraphPath:[NSString stringWithFormat:@"%@/feed",friendId] andParams:postVariablesDictionary andHttpMethod:@"POST" andDelegate:nil];

NSLog(@"message: %@",postVariablesDictionary);
[postVariablesDictionary release];

UIAlertView *facebookAlter=[[UIAlertView alloc] initWithTitle:@"Message" message:@"Posted successfully on facebook" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil, nil];
[facebookAlter show];
[facebookAlter release]; 

[self dismissModalViewControllerAnimated:YES];    
}
相关问题