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 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.
FBSDKShareDialogMode sets to FeedBrowser resolves my issue
Use quote property of FBSDKShareLinkContent instead
setContentTitle
andsetContentDescription
have been deprecated from Graph API 2.9. For more information, see https://developers.facebook.com/docs/apps/changelog#v2_9_deprecationsI've faced a same problem and found out one workaround - direct setting mode of FBSDKShareDialog instance to FBSDKShareDialogModeFeedWeb.
It displays the feed dialog in a UIWebView within the app with preview of your post with right title and description.