Facebook FBWebDialogs options let you invite multiple friends at once

I couldn't find anything in the FB documentation, but basically what I'm looking for is the ability to add multiple FacebookIds to Params for FBWebDialogs. Here is an example of what I tried, but of course this is wrong:

NSMutableDictionary* params =   [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                 facebookID1, @"to", 
                                 facebookID2, @"to",
                                 facebookID3, @"to",
                                 nil];

FBFrictionlessRecipientCache *friendCache = [[FBFrictionlessRecipientCache alloc] init];
[friendCache prefetchAndCacheForSession:nil];

[FBWebDialogs presentRequestsDialogModallyWithSession:nil
                                              message:[NSString stringWithFormat:@"هل سمعت باليومي؟ برنامج iPhone إخباري روعا"]
                                                title:nil
                                           parameters:params
                                              handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
                                                  if (error) {
                                                      // Case A: Error launching the dialog or sending request.
                                                      NSLog(@"Error sending request.");
                                                  } else {
                                                      if (result == FBWebDialogResultDialogNotCompleted) {
                                                          // Case B: User clicked the "x" icon
                                                          NSLog(@"User canceled request.");
                                                      } else {
                                                          NSLog(@"Request Sent. %@", error);
                                                      }
                                                  }}
                                          friendCache:friendCache];
+1
source share
2 answers

Simple, put all these lines in an array, and then the object in the parameters is an array of strings, and the key is from to.

+1
source

For several identifiers in the FBWebDialogs parameters, you must set the keys as "from [0]", "to [1]", ... "to [n]":

NSMutableDictionary* params =   [NSMutableDictionary dictionaryWithObjectsAndKeys:
                             facebookID1, @"to[0]", 
                             facebookID2, @"to[1]",
                             facebookID3, @"to[2]",
                             nil];
+1
source

All Articles