0

ボタンをクリックすると招待状を送信するための完全なコードがあり、ポップアップメニューが表示され、ポップアップメニューで...

エラー。

ゲームリクエストはゲームで利用できます。

友達を招待するための私のコードは次のとおりです。

 NSDictionary *parameters = @{@"to":@""};

[FBWebDialogs presentRequestsDialogModallyWithSession:nil
                                              message:@"message aaya kya"                                                    title:@"app request"
                                           parameters:parameters
                                              handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error)
 {
     if(error)
     {
         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];
        // [alrt release];
     }
     else
     {
         if (![resultURL query])
         {
             return;
         }
         
         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"]);
         }
         if ([recipientIDs count] > 0)
         {
             //[self showMessage:@"Sent request successfully."];
             //NSLog(@"Recipient ID(s): %@", recipientIDs);
             UIAlertView *alrt = [[UIAlertView alloc] initWithTitle:@"Success!" message:@"Invitation(s) sent successfuly!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
             [alrt show];
             //[alrt release];
         }
         
     }
 }
                                          friendCache:nil];


}

どこが間違っているのですか?私を助けてください。ありがとう。

4

2 に答える 2

0

FBSDKGameRequestContent を試してみませんか (Facebook SDK 4.0 が必要です)。

注: これは、アプリ カテゴリが Facebook 開発者ページのゲームである場合にのみ機能します。

コードは次のとおりです。

FBSDKGameRequestContent *gameRequestContent = [[FBSDKGameRequestContent alloc] init];
     // Look at FBSDKGameRequestContent for futher optional properties
     FBSDKGameRequestDialog *dialog = [[FBSDKGameRequestDialog alloc]init];
     dialog.delegate = self;
     dialog.content = gameRequestContent;

     gameRequestContent.message = @"Become a Ninja!!!";
     gameRequestContent.title = @"NinjaPan";
     dialog.delegate = self;
     dialog.content = gameRequestContent;
     [dialog show];

そしてそれはデリゲートメソッドです:

- (void)gameRequestDialog:(FBSDKGameRequestDialog *)gameRequestDialog didCompleteWithResults:(NSDictionary *)results{
if (results) {

      }
}

- (void)gameRequestDialog:(FBSDKGameRequestDialog *)gameRequestDialog didFailWithError:(NSError *)error{
if (error) {
    NSLog(@"%@",error.localizedDescription);
   }
}

- (void)gameRequestDialogDidCancel:(FBSDKGameRequestDialog *)gameRequestDialog{
NSLog(@"Cancelled by user");
}
于 2015-06-05T04:21:24.323 に答える