本文介绍了使用FBWebdialogs发布到朋友墙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用下面的代码在 Facebook 上发布,在Params词典中输入了所有必需的详细信息,并在 FBWebDialogs 中添加了该帖子,但是该帖子未显示在好友墙上.

I used below code to post on Facebook,entered all required details in Params dictionary and added in FBWebDialogs, but the post is not displaying in friend wall.

NSDictionary *params = @{
                        @"name" :[NSString stringWithFormat:@"%@",[Data_Dict objectForKey:@"name"]],
                        @"caption" : @"",
                        @"description" :[Data_Dict objectForKey:@"desc_title"],
                        @"picture" : str_link,
                        @"link" : @"",
                      };

[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.");
        } 
        else 
        {
          //NSLog(@"Story published.");
        }
    }}];
   }
 }];

期望有解决此问题的想法.

Expecting ideas to fix this issue.

推荐答案

[FBSession openActiveSessionWithReadPermissions:nil allowLoginUI:YES completionHandler:^(FBSession *session,FBSessionState state, NSError *error)
 {
     if (error)
     {
         UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:error.localizedDescription delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
         [alertView show];
     }
     else if(session.isOpen)
     {
         //NSLog(@"%@",Data_Dict);

         NSString *str_link = [NSString stringWithFormat:@"%@uploads/%@-5.jpg",app.Main_url,[Data_Dict objectForKey:@"deal_id"]];
         //NSLog(@"%@",str_link);

         NSDictionary *params = @{
                                  @"name" :[NSString stringWithFormat:@"%@",[Data_Dict objectForKey:@"name"]],
                                  @"caption" : @"",
                                  @"description" :[Data_Dict objectForKey:@"desc_title"],
                                  @"picture" : str_link,
                                  @"link" : @"",
                                  };

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

return;

这篇关于使用FBWebdialogs发布到朋友墙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 16:20