hangyc
hangyc

Reputation: 11

Facebook iOS App Invite Friends

I am using Facebook SDK to connect Facebook in my app. User can send invitation to their friends. (Using the Requests dialog provided by FB SDK).

https://developers.facebook.com/docs/tutorials/ios-sdk-games/requests/

And I'm trying to keep the friend list clear if the friend is already invited (ever the friend is accepted or not), hide the friend from the list. But I can't find the way to do this. Is there a way to do this?

Upvotes: 1

Views: 4296

Answers (2)

techsMex
techsMex

Reputation: 604

Facebook documentation is horrible but I found it is possible exclude authenticated friends as follows:

// See https://developers.facebook.com/docs/games/requests/v2.1 for explanation of the possible parameter keys
NSMutableDictionary* params =   [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                 // Optional parameter for sending request directly to user
                                 // with UID. If not specified, the MFS will be invoked
                                 // @"RECIPIENT_USER_ID", @"to",
                                 // Give the action object request information
                                 // @"send", @"action_type",
                                 // @"YOUR_OBJECT_ID", @"object_id",
                                   @"app_non_users", @"filters",
                                 nil];

[FBWebDialogs
 presentRequestsDialogModallyWithSession:nil
 message:@"Join me!"
 title:@"Invite Friends"
 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.");
         }
     }
 }];

@"app_non_users", @"filters", is the important part!

Upvotes: 1

Robert
Robert

Reputation: 606

I dont think you can exclude friends that have had the request sent to them but you can suggest friends to populate in that list. Perhaps if you already know who you have sent the request to you can populate the list with the rest of your friends.

Upvotes: 0

Related Questions