0

This code is not generating notification on friend's end.But sending successully generating no error.I am building a app for Game url on friend to invite them to play.i have written below code to send url.it's working fine and not generating no error but user is not getting any request for App.

        //Fbwebdialog  generating no error
        [FBWebDialogs presentRequestsDialogModallyWithSession:[FBSession activeSession]
                    message:[NSString stringWithFormat:@"I just smashed  friends! Can you beat it?"]
                    title:nil
                    parameters:params
                    handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
                    if (error) {
                        // Case A: Error launching the dialog or sending request.
                        NSLog(@"Some errorr: %@", [error description]);
                        UIAlertView *alrt = [[UIAlertView alloc] initWithTitle:@"Invitiation Sending Failed" message:@"Unable to send inviation at this Moment, please make sure your are connected with internet" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
                            [alrt show];
                            } else {
                                    if (![resultURL query]) {
                                        return ;
                                        NSLog(@"User canceled request.");
                                        } else {
                                            NSDictionary *params = [self parseURLParams:[resultURL query]];
                                            NSMutableArray *recipientIDs = [[NSMutableArray alloc] init];
                                            for (NSString *paramKey in params){
                                                    if ([paramKey hasPrefix:@"to["]){

                                                            [recipientIDs addObject:[params objectForKey:paramKey]];

                                                            }
                                                          }
                                                        if ([params objectForKey:@"request"]){

                                                              NSLog(@"Request ID: %@", [params objectForKey:@"request"]);
                                                            NSArray *requestIDs=[params objectForKey:@"request"];

                                                          }
                                                          if ([recipientIDs count] > 0){

                                                              //[self showMessage:@"Sent request successfully."];
                                                              //NSLog(@"Recipient ID(s): %@", recipientIDs);

                                                             // punGameViewController *pun=[[punGameViewController alloc]initWithNibName:@"punGameViewController" bundle:nil];

                                                              UIAlertView *alrt = [[UIAlertView alloc] initWithTitle:@"Success!" message:@"Successfully send" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
                                                              [alrt show];

                                                            //  [self.navigationController pushViewController:pun animated:YES];



                                                          } 

                                                      }
                                                  }

                                            }];
          //end of code here

check it find the reason not generating notification.

Ravee10
  • 355
  • 1
  • 3
  • 13

2 Answers2

2

I found my answer to this question on a previously answered S/O question. Basically, you need to set the App Store Id and Bundle Id in the Facebook App settings in order for invites to get sent. You can find that info: here

Community
  • 1
  • 1
Brian Sachetta
  • 3,319
  • 2
  • 34
  • 45
0

Notifications sent by your app is only received on mobile devices if your app is a game. If your app is not a game, notifications are still delivered to the App Center on the desktop.

Developer
  • 760
  • 3
  • 15