在iOS中使用URL共享Facebook时缺少说明

时间:2015-05-14 04:52:39

标签: ios objective-c iphone slcomposeviewcontroller

当我使用SLComposerViewController在Facebook上分享iTunes网址时,Facebook上的帖子没有显示链接描述。如果我尝试其他URL,那么我的帖子显示链接描述。

1 个答案:

答案 0 :(得分:0)

if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {

    SLComposeViewController *mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];

    [mySLComposerSheet addImage:[UIImage imageNamed:@"s_720.jpg"]];
    [mySLComposerSheet setInitialText:@"check my swap card..."];
    [mySLComposerSheet addURL:[NSURL URLWithString:[swap_card_dict valueForKey:@"swapcard_url"]]];
    [mySLComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) {
      switch (result) {
               case SLComposeViewControllerResultCancelled:
               NSLog(@"Post Canceled");
               break;
               case SLComposeViewControllerResultDone:
                {
                 NSLog(@"Post Sucessful");
                }
                break;

               default:
                 break;
                }
            }];

[[self viewController] presentViewController:mySLComposerSheet animated:YES completion:nil];

}