是否可以在用户朋友墙上发布一些内容,而无需先获得所有朋友(这样您就可以获得朋友 ID)?
[facebook requestWithGraphPath:@"me/friends" andDelegate:self];
是否可以在用户朋友墙上发布一些内容,而无需先获得所有朋友(这样您就可以获得朋友 ID)?
[facebook requestWithGraphPath:@"me/friends" andDelegate:self];
您可以通过向 发出请求来获取登录用户的朋友me/friends
。
然后,您可以创建一个显示朋友列表的 ui 元素,用户可以选择他想要分享的人。
FRIEND_ID/feed
然后,在用户选择后,您只需通过向(用户对象的 Feed 连接)发出 POST 来在他们的墙上发帖。
您需要拥有publish_stream
允许您的权限:Enables your app to post content, comments, and likes to a user's stream and to the streams of the user's friends
(http://developers.facebook.com/docs/authentication/permissions/)
看到这个
-(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];
}