I have images and FB friends names in a user table view. How to get the selected row in the FB ID and send a request to several friends?

I have one FB identifier and it does not work in several ways. I got a custom table view in the FB friends list. How to get selected FB ID strings

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);
 } ];


}
+4
source share
1 answer

Look at the downloaded SDK source files (maybe they are installed in the "My Documents" folder). One example source code is called FriendPickerSample.xcodeproj

, , FB iOS Tableview, FPViewController, UIViewController, allowMultipleSelection, , TRUE, , "".

""

- (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>"];     
}

, , , .

+1

All Articles