Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
787 views
in Technique[技术] by (71.8m points)

ios - How to share multiple post on friend's wall in objective C

I'm using facebook sdk to post on friend's wall. I am able to post it but when i select multiple friends in FBWebDialog instead of posting two friends simultaneously for each friend a separate dialog box is shown. How to post on multiple friend's wall .

-(void)showFriendsList
{
    friendPickerController = [[FBFriendPickerViewController alloc] init];
    friendPickerController.title = @"Pick Friends";
    friendPickerController.delegate = self;
    [friendPickerController loadData];
}

-(IBAction)facebookShare:(UIButton *)sender
{
    [friendPickerController presentModallyFromViewController:self animated:YES handler:
     ^(FBViewController *sender, BOOL donePressed) {

         if (!donePressed)
         {
             return;
         }

         NSString* fid;
         NSString* fbUserName;

         for (id<FBGraphUser> user in friendPickerController.selection)
         {
             NSLog(@"
user=%@
", user);
             fid = user.id;

             fbUserName = user.name;

             NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:remedyLabel, @"caption", appIcon, @"picture",symptomName, @"name",remedyDescription,@"description",fid,@"tags",fid,@"to",@"106377336067638",@"place", nil];

             NSLog(@"
params=%@
", params);

             [FBRequestConnection startWithGraphPath:[NSString stringWithFormat:@"%@/feed",fid] parameters:params               HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection,id result,NSError *error)
              {
                  [FBWebDialogs presentFeedDialogModallyWithSession:nil                                                     parameters:params  handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error)

                   {
                       if (error)
                       {

                           NSLog(@"Error publishing story.");
                       }
                       else
                       {
                           if (result == FBWebDialogResultDialogNotCompleted) {
                               // User clicked the "x" icon
                               NSLog(@"User canceled story publishing.");
                           }
                           else
                           {

                               // Handle the publish feed callback

                               //Tell the user that it worked.
                               NSLog(@"Request Sent");
                           }

                       }
                   }];
              }];

         }

     }];
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

No, that's not possible. You have to open separate dialog for each friend.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...