Ali Hassan
Ali Hassan

Reputation: 519

Facebook invitation to my app not working

I used following code to invite a friend to my app:

        NSString *facebookID = user.id;
        NSMutableDictionary* params =
        [NSMutableDictionary dictionaryWithObject:facebookID forKey:@"to"];
        NSString *message = @"SOME_MESSAGE";
        NSString *title = @"TITLE";


        FBSession *facebookSession = [PFFacebookUtils session];  //You may changed this if you are not using parse.com

        [FBWebDialogs presentRequestsDialogModallyWithSession:facebookSession
                                                      message:message
                                                        title:title
                                                   parameters:params handler:
         ^(FBWebDialogResult result, NSURL *resultURL, NSError *error)
         {
             if (!error) {
                 NSLog(@"Succees:%@",resultURL);
             }
         }];        }

Opens WebDialog as shown: enter image description here But I see no invitation on my profile. How do I get it done properly?

Upvotes: 0

Views: 123

Answers (2)

Bhavesh Nayi
Bhavesh Nayi

Reputation: 3656

        str_id = [[app.Arr_Facebook_Frnd objectAtIndex:indexpath] objectForKey:@"id"];
        str_name = [[app.Arr_Facebook_Frnd objectAtIndex:indexpath] objectForKey:@"name"];
        str_link = @"www.google.com";

NSDictionary *params = @{
                             @"name" : str_name,
                             @"caption" : @"",
                             @"description" : @"",
                             @"picture" : @"",
                             @"link" : str_link,
                             @"to":str_id,
                             };


    // Invoke the dialog
    [FBWebDialogs presentFeedDialogModallyWithSession:nil
                                           parameters:params
                                              handler:
     ^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
         if (error) {
             NSLog(@"Error publishing story.");
             [self.indicator stopAnimating];
         } else {
             if (result == FBWebDialogResultDialogNotCompleted) {
                 NSLog(@"User canceled story publishing.");
                 [self.indicator stopAnimating];
             } else {
                 NSLog(@"Story published.");
                 [self.indicator stopAnimating];
             }
         }}];
    [self.indicator stopAnimating];

Upvotes: 2

Niro
Niro

Reputation: 394

you didn't mention if the console printed "Success...." or not.

anyway, if the request is successfull users will see it only on fb mobile app

Upvotes: 1

Related Questions