FBSDKShareLinkContent is not setting the contentDescription and contentTitle

前端 未结 4 2083
广开言路
广开言路 2021-02-18 21:48

I am trying to share a link on the Facebook using FBSDKShareLinkContent.

I have set the URL, description and title. SDK is automatically populates the titl

相关标签:
4条回答
  • 2021-02-18 21:52

    I've faced a same problem and found out one workaround - direct setting mode of FBSDKShareDialog instance to FBSDKShareDialogModeFeedWeb.

    FBSDKShareDialog* dialog = [[FBSDKShareDialog alloc] init];
    dialog.mode = FBSDKShareDialogModeFeedWeb;
    dialog.shareContent = content;
    dialog.fromViewController = self;
    [dialog show];
    

    It displays the feed dialog in a UIWebView within the app with preview of your post with right title and description.

    0 讨论(0)
  • 2021-02-18 22:00

    Use quote property of FBSDKShareLinkContent instead

    FBSDKShareLinkContent *linkContent = [FBSDKShareLinkContent new];
    linkContent.quote = @"your quote";
    
    FBSDKShareDialog *shareDialog = [FBSDKShareDialog new];
    shareDialog.shareContent = linkContent;
    

    setContentTitle and setContentDescription have been deprecated from Graph API 2.9. For more information, see https://developers.facebook.com/docs/apps/changelog#v2_9_deprecations

    0 讨论(0)
  • 2021-02-18 22:08

    I tried this code and it works perfectly on my virtual device, until I setted up Facebook account in setting of phone. After I set that, every time that I want to open dialog was opened default iOS social share dialog. Delete your account, if it exist in settings, or just install FB application, in documentation I saw that we need FB app for sharing.

    If this will not help, you can always use Social Share framework of iOS, here is the example.

    http://www.appcoda.com/ios-programming-101-integrate-twitter-and-facebook-sharing-in-ios-6/

    Hope this will help, by the way, today I stack on this problems too, now every thing working great with this Social Sharing framework of iOS.

    0 讨论(0)
  • 2021-02-18 22:12

    FBSDKShareDialogMode sets to FeedBrowser resolves my issue

    let dialog = FBSDKShareDialog()
    dialog.fromViewController = self
    dialog.shareContent = shareLink
    dialog.mode = FBSDKShareDialogMode.FeedBrowser
    dialog.show()
    
    0 讨论(0)
提交回复
热议问题