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 title and description by information scraped from the contentURL
.
But I want to set custom title and description that I have given in code. Is there anyway to avoid this behaviour?
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
[content setContentTitle:@"Testing title"];
[content setContentDescription:@"Testing description."];
content.contentURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://www.google.co.in/"]];
[FBSDKShareDialog showFromViewController:self
withContent:content
delegate:nil];
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.