Facebook邀请我的应用程序无法正常工作

时间:2014-04-09 09:53:18

标签: ios facebook

我使用以下代码邀请朋友加入我的应用:

        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);
             }
         }];        }

打开WebDialog,如下所示:enter image description here 但我看到我的个人资料没有邀请。我如何正确完成它?

2 个答案:

答案 0 :(得分:2)

        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];

答案 1 :(得分:1)

你没有提到控制台是否打印了“成功......”。

无论如何,如果请求成功,用户将只在fb移动应用上看到它