2012-05-27 143 views
2

是否有可能在用户朋友墙上发布内容,而不必先获取所有朋友(所以你可以获得朋友ID)?Facebook API:发布在朋友墙上

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

只有当你知道朋友身份证..但你想做什么?在我看来,在某些时候你正在展示一位朋友,以便用户真正知道他/她正在发送消息,对吗? –

+0

我想要一个名为“与朋友分享这个按钮”的按钮...所以如果你可以在显示所有朋友的facebook api中获得一个列表,那么这将很好,然后你可以检查你想要的列表分享信息,并公平的分享.. – BlackMouse

+0

好的...好吧,使用您发布的电话来获取所有的朋友,并将标识符存储在一个阵列中,以便您可以向他们发送消息... –

回答

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];  
} 
+0

真的不好显示一个成功的戒备,甚至没有确定它确实是成功的。为此使用FB委托方法。 –

+0

感谢您的回复。但是,通过这种方法,您必须知道朋友ID ...我想处理所有在facebook popup API中的所有内容? – BlackMouse

3

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

然后,在用户选择后,您只需发布POST到FRIEND_ID/feedFeed connection of the User object)即可在墙上张贴。
你需要有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/)

相关问题