0

此代码不会在朋友端生成通知。但是成功发送不会产生错误。我正在为朋友的游戏 url 构建一个应用程序以邀请他们玩。我已经编写了下面的代码来发送 url。它工作正常并且不会产生错误但用户没有收到任何对 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

检查它找到不生成通知的原因。

4

2 回答 2

2

我在之前回答的 S/O 问题上找到了我对这个问题的答案。基本上,您需要在 Facebook 应用设置中设置 App Store Id 和 Bundle Id 才能发送邀请。您可以找到该信息:这里

于 2014-06-25T20:56:54.550 回答
0

只有当您的应用是游戏时,您的应用发送的通知才会在移动设备上接收。如果您的应用不是游戏,通知仍会发送到桌面上的应用中心。

于 2013-10-09T11:57:27.393 回答