Facebook API:张贴在朋友墙上
是否有可能在用户朋友墙上张贴一些东西,而不必先得到所有的朋友(所以你可以得到朋友ID)?
[facebook requestWithGraphPath:@"me/friends" andDelegate:self];
看到这个
-(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]; }
您可以通过向me/friends
发送请求来获取login用户的me/friends
。
然后你可以创build一个显示朋友列表的用户界面元素,用户可以select他想要分享的元素。
然后,用户select后,只需发布POST到FRIEND_ID/feed
( 用户对象的Feed连接),即可在墙上张贴。
您需要拥有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 /许可/)