Reputation: 4572
Is it possible to post something on a users friends wall, without having to get all the friends first (So you can get the friend id)?
[facebook requestWithGraphPath:@"me/friends" andDelegate:self];
Upvotes: 2
Views: 2073
Reputation:
See this
-(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];
}
Upvotes: 3
Reputation: 164129
You can get the friends of the logged in user by issuing a request to me/friends
.
Then you can create a ui element that shows the list of friends and the user can select the ones he want to share with.
Then, after the user selected you simply post on their walls by issuing a POST to FRIEND_ID/feed
(Feed connection of the User object).
You'll need to have the publish_stream
permissions which lets you: 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/)
Upvotes: 3