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

守給你的承諾、 提交于 2019-12-18 07:12:50

问题


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(@"\nuser=%@\n", 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(@"\nparams=%@\n", 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");
                           }

                       }
                   }];
              }];

         }

     }];
}

回答1:


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



来源:https://stackoverflow.com/questions/16834007/how-to-share-multiple-post-on-friends-wall-in-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!