2014-04-09 74 views
0

我用下面的代码来邀请朋友到我的应用程序: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 但是我看到我的个人资料没有邀请。我如何正确完成它?

+0

尝试一些其他的ID。 –

+0

我已经尝试...发送给其他朋友,但没有通知.. –

回答

1

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

无论如何,如果请求是全成用户会看到它只能在FB移动应用

+0

请求成功,它不会显示在手机浏览器? –

+0

应该有。请在fb应用程序设置中检查以下内容:1.深度链接; 2.不是沙箱; 3.应用程序被添加到fb应用程序 – Niro

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]; 
相关问题