2014-04-09 105 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]; 
相關問題