FBSDKShareLinkContent未使用我设置的peopleID标记人员

时间:2015-12-03 05:44:49

标签: ios facebook sdk share

我关注https://developers.facebook.com/docs/ios/getting-started/share-button上的Facebook SDK文档,我通过peopleIDs标记的人未在我分享的帖子中标记。

NSURL *imageURL = [NSURL URLWithString:@"http://upload.wikimedia.org/wikipedia/commons/thumb/9/95/Facebook_Headquarters_Menlo_Park.jpg/2880px-Facebook_Headquarters_Menlo_Park.jpg"];
NSURL *contentURL = [[NSURL alloc] initWithString:@"http://en.wikipedia.org/wiki/Facebook"];

FBSDKShareLinkContent *content = [FBSDKShareLinkContent new];
content.contentURL = contentURL;
content.contentTitle = @"My Share Title";
content.contentDescription = @"Lorem ipsum dolor sit amet.";
content.imageURL = imageURL;
content.peopleIDs = @[@"10206439771816757"];
content.placeID = @"166793820034304";
content.ref = @"myRefId";

我修改了示例代码,以便为一位朋友使用ID,但他们没有被标记。我如何标记朋友?

这个API调用发生了一些奇怪的事情,正如其他SO帖子FBSDKShareLinkContent is not setting the contentDescription and contentTitle所揭示的那样,所以我想知道是否有一些技巧可以让人们被标记。

更新: 如果您使用FBSDKShareButton来共享网址,则可以看出标记是否有效。但是,我想使用FBSDKShareDialog分享和标记用户。我似乎找不到办法来做到这一点。

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,在我看来,只有在使用本机应用程序显示共享对话框时才支持标记人员。

我的解决方案是首先尝试FBSDKShareDialogModeNative,否则回到默认FBSDKShareDialogModeAutomatic

- (void)shareLinkContent:(FBSDKShareLinkContent *)linkContent fromViewController:(UIViewController *)viewController
{
    FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
    dialog.fromViewController = viewController;
    dialog.shareContent = linkContent;

    // Try the native mode first. If it isn't supported,
    //  fall back on automatic mode.
    dialog.mode = FBSDKShareDialogModeNative;
    if (![dialog canShow]) {
        dialog.mode = FBSDKShareDialogModeAutomatic;
    }

    [dialog show];
}