-1

I am using the following code to post on device user's wall. I have managed to get the friends list and their ids too. Using the friend's id how can I use the following code to post on selected friend's wall depending on friend's id?

if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
    SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook ];
    SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result) {
        if (result == SLComposeViewControllerResultCancelled) {
            NSLog(@"Cancelled");

        } else {
            UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Posted!!!" 
            message:@"your status is posted to facebook successfully" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];                
            [alert show];
        }

        [controller dismissViewControllerAnimated:YES completion:Nil];
    };

    controller.completionHandler =myBlock;

    [controller setInitialText:@" hello there you got a text ..."];

    [self presentViewController:controller animated:YES completion:Nil];
}
J. Steen
  • 15,470
  • 15
  • 56
  • 63
ios Dev
  • 68
  • 7
  • This has already been answered here: http://stackoverflow.com/questions/4126400/api-facebook-iphone-possible-to-post-to-a-friends-wall – Anton Dec 11 '12 at 15:48

3 Answers3

0

Take a look at the question Anton pointed you to. However, to my understanding, Facebook will be removing the ability to post to a friends wall using the Graph API in February 2013. Instead you will need to create a post by invoking the Feed Dialog and tagging friends in the post. The post will then appear on their wall (assuming they approve it). You'll want to keep this in mind as you decide how to go about this.

Forrest Bice
  • 602
  • 5
  • 16
0

Posting to other users wall is as of February 6, 2013, deprecated.

https://developers.facebook.com/roadmap/completed-changes/

Removing ability to post to friends walls via Graph API

We will remove the ability to post to a user's friends' walls via the Graph API. Specifically, posts against [user_id]/feed where [user_id] is different from the session user, or stream.publish calls where the target_id user is different from the session user, will fail. If you want to allow people to post to their friends' timelines, invoke the feed dialog. Stories that include friends via user mentions tagging or action tagging will show up on the friend’s timeline (assuming the friend approves the tag). For more info, see this blog post.

Community
  • 1
  • 1
adamkonrad
  • 6,794
  • 1
  • 34
  • 41
0

You can't post to friend's wall from API, But can be published to their Stream

vipintklm
  • 9
  • 4