I have FB friends images and names in custom table view. How to get selected row in FB ID's and send request to multiple friends?

I have got single FB ID's and it's not working in multiple selection.I got custom table view in FB friend list. How to get selected row FB ID's

NSMutableArray *arryOfFBIds;
for (id<FBGraphUser> user in self.friendPickerController.selection) {

    NSMutableArray *selection=(NSMutableArray *) self.friendPickerController.selection;
     [selection addObject:user.id];


    arryOfFBIds = [[NSMutableArray alloc] init];
    for (id<FBGraphUser> user in self.friendPickerController.selection)
    {
        [arryOfFBIds addObject:user.id ];





                NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject: arryOfFBIds forKey: @"SelectedFBIds"];
    [defaults synchronize];
        NSLog(@"array of fb id:%@",arryOfFBIds);
    }}




NSMutableDictionary* params2 =   [NSMutableDictionary dictionaryWithObjectsAndKeys:@"Invite to on Ensmbl", @"description", @"http://placebogames.com/", @"link",
                                 // 3. Suggest friends the user may want to request, could be game context specific?
                                 [arryOfFBIds componentsJoinedByString:@","],@"to",  nil];
NSLog(@"qwer:%@",params2);



[FBWebDialogs presentFeedDialogModallyWithSession:[FBSession activeSession] parameters:params2  handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error)
{
     NSLog(@"error===>%@,resultURL===>%@",error,resultURL);
 } ];


}

Answers


look at your downloaded SDK source files (probably installed in My Documents folder) - One of the sample source codes is called FriendPickerSample.xcodeproj

In a nutshell to display a table view of friends, FB iOS uses a special custom tableview controller class called the FPViewController it is inherits from UIViewController but has the allowsMultipleSelection property which if set to TRUE will allow you to pick several friends until you press the Done button.

The Done Button will trigger a delegate method called

- (void)facebookViewControllerDoneWasPressed:(id)sender {
   NSMutableString *text = [[NSMutableString alloc] init];

   // we pick up the users from the selection, and create a string that we use to     update the text view
   // at the bottom of the display; note that self.selection is a property inherited     from our base class
   for (id<FBGraphUser> user in self.friendPickerController.selection) {
        if ([text length]) {
           [text appendString:@", "];
       }
      [text appendString:user.name];
   }

    [self fillTextBoxAndDismiss:text.length > 0 ? text : @"<None>"];     
}

Just use the sample code and modify so you can do whatever you wish to he array of selected friends.


Need Your Help

Problem with loading google map v3 asynchronously

php jquery google-maps-api-3

My current solution for loading Google map scripts, is the old fashion way.

Mocha's glob behaviour

node.js mocha glob

My directory follows this structure: