Question

I can post image to facebook friend's wall using FBWebDialogs.What am looking is how can i post image to multiple Friends... Below is my code for single post

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               @"Sharing Tutorial", @"name",
                               @"Build great social apps and get more installs.", @"caption",
                               @"Allow your users to share stories on Facebook from your app using the iOS SDK.", @"description",
                               @"https://developers.facebook.com/docs/ios/share/", @"link",
                               @"http://i.imgur.com/g3Qc1HN.png", @"picture",
                               @"100006771363037",@"to",
                                nil];

// Show the feed dialog
[FBWebDialogs presentFeedDialogModallyWithSession:nil
                                       parameters:params
                                          handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
                                            if (error) {
                                              // An error occurred, we need to handle the error
                                              // See: https://developers.facebook.com/docs/ios/errors
                                              NSLog(@"Error publishing story: %@", error.description);
                                            } else {
                                              if (result == FBWebDialogResultDialogNotCompleted) {
                                                // User canceled.
                                                NSLog(@"User cancelled.");
                                              } else {
                                                // Handle the publish feed callback
                                                NSDictionary *urlParams = [self parseURLParams:[resultURL query]];

                                                if (![urlParams valueForKey:@"post_id"]) {
                                                  // User canceled.
                                                  NSLog(@"User cancelled.");

                                                } else {
                                                  // User clicked the Share button

                                                    NSLog(@"fb web dialog result=====>%@",result);
                                                  NSString *result = [NSString stringWithFormat: @"Posted story, id: %@", [urlParams valueForKey:@"post_id"]];
                                                  NSLog(@"result %@", result);
                                                }
                                              }
                                            }
                                          }];

While adding friends profile_id's separated by comma in @"to" field getting error.Added screen shot in below

Was it helpful?

Solution

You cannot add multiple ids in the to parameter in a Feed Dialog. In fact there's no way to post a feed to multiple friends at once. You have to invoke the dialog for each of the friend separately.

According to documentation, to is:

The ID or username of the profile that this story will be published to. If this is unspecified, it defaults to the value of from.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top