0

I'm using the Facebook sdk in my app. There is a screen where I want to send invite to my Facebook friends to join my app. I'm using the below code to do that and setting the parameter "app_non_users" in it so that among all my friends I want those who have not authorised my app. This code is working fine for me.

SBJSON *jsonWriter = [SBJSON new];

NSArray *filters = [NSArray arrayWithObject:@"app_non_users"];

NSString *filtersString = [jsonWriter stringWithObject:filters];

NSMutableDictionary* params =
[NSMutableDictionary dictionaryWithObjectsAndKeys:
 @"invite",  @"message",
 @"Check this out", @"notification_text",
 filtersString, @"filters",
 @"Invite Friends", @"title",
 nil];

[FBWebDialogs
 presentRequestsDialogModallyWithSession:nil
 message:@"App Invite"
 title:nil
 parameters:params
 handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
     if (error) {
         // Error launching the dialog or sending the request.
         NSLog(@"Error sending request.");
     } else {
         if (result == FBWebDialogResultDialogNotCompleted) {
             // User clicked the "x" icon
             NSLog(@"User canceled request.");

             [self actionBack:nil];
         } else {
             // Handle the send request callback
             NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
             if (![urlParams valueForKey:@"request"]) {
                 // User clicked the Cancel button
                 NSLog(@"User canceled request.");

                 [self actionBack:nil];
             } else {
                 // User clicked the Send button
                 NSString *requestID = [urlParams valueForKey:@"request"];
                 NSLog(@"Request ID: %@", requestID);

                 NSLog(@"%@",resultURL);
             }
         }
     }
 }];

I got this response on success,

fbconnect://success?request=1530223140578996&to%5B0%5D=398672303626018

I extracted the "to" id from the above response which is "398672303626018" in the above case but that is not the actual Facebook user id of that user whom I invited. Actually his Facebook is this one "100004497541090". So my question is how can I get the Facebook user id of the invited user who has not previously authorised my app. Thanks in advance!

Rahul Bansal
  • 1,382
  • 15
  • 22
  • 398672303626018 is the actual Facebook id. It is an app scoped user id. And there is no way to get the global user id – WizKid Jan 16 '15 at 07:27
  • @WizKid but once I login with the invited user and authorise the app, the next time in the same above code, I got the actual facebook id of that invited user that I want. – Rahul Bansal Jan 16 '15 at 09:06
  • You should always get the app scoped user id. If you get something else you should file a bug at https://developers.facebook.com/bugs – WizKid Jan 16 '15 at 16:41

0 Answers0