IOS中的FBDialog共享中未显示缩略图图像

时间:2014-05-06 13:42:15

标签: ios objective-c facebook facebook-graph-api

我尝试通过对话框发布FB。

但我的图片在对话框中没有显示为缩略图。 当我发布时,图像显示在Web上但未在对话框中显示。

我的代码如下:

    FBShareDialogParams *params = [[FBShareDialogParams alloc] init];
        params.link = [NSURL URLWithString:[Dict objectForKey:@"url"]];
        params.name = [Dict objectForKey:@"name"];
        params.caption = [Dict objectForKey:@"dicription"];
        params.picture=[NSURL URLWithString:@"https://s3-us-west-2.amazonaws.com/appicon/facebook-share-logo.png"];
        params.description = [Dict objectForKey:@"dicription"];

if ([FBDialogs canPresentShareDialogWithParams:params])
        {
            /*
            [FBDialogs presentShareDialogWithLink:params.link
                                             name:params.name
                                          caption:params.caption
                                      description:params.description
                                          picture:params.picture
                                      clientState:nil
                                          handler:^(FBAppCall *call, NSDictionary *results, NSError *error)
             {
                 if(error)
                 {
                     // An error occurred, we need to handle the error
                     // See: https://developers.facebook.com/docs/ios/errors
                     //NSLog(@"%@",[NSString stringWithFormat:@"Error publishing story: %@", error.description]);
                 }
                 else
                 {
                     // Success
                     //NSLog(@"result %@", results);
                 }
             }];
}

我也推荐此链接:Same Issue

但仍然无法解决。

帮我解决这个问题。

1 个答案:

答案 0 :(得分:0)

请尝试这个:

SLComposeViewController *Facebooksheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[Facebooksheet addImage:[UIImage imageNamed:@"image.png"]];
[self presentViewController:Facebooksheet animated:YES completion:nil];

请添加Social.Framework框架。