I have integrated Facebook Sharing of a link with a description, caption, etc via the Native Facebook App (if it is installed) using the code:
FBLinkShareParams *params = [[FBLinkShareParams alloc] initWithLink:[NSURL URLWithString:#"https://abcde.com"]
name:#"demo"
caption:#"demo"
description:#"demo"
picture:nil];
//Present share dialog
[FBDialogs presentShareDialogWithParams:params clientState:nil handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(#"Error publishing story: %#", error.description);
} else {
// Success
NSLog(#"result %#", results);
}
}];
When this method runs, and the native facebook app is installed, I get an option to share a post that has caption, link and description. When I click share and I go on FB to check it, it appears to only have the link?
Can someone suggest a possible fix?
Most likely it is due to newest Facebook sharing policy 2.3
Related
I am trying to share a link using the FB messenger. When i try to share the link to facebook i keep getting an error. I googled for an answer and the couple of solutions i found did not help since everything in the plist is correct. If anyone has any advice i would really appreciate it, been trying to solve this all day.
Error:
Invalid use of FBAppCall, fb839771929379526 is not registered as a URL Scheme. Did you set 'FacebookUrlSchemeSuffix' in your plist?
Code:
// Check if the Facebook app is installed and we can present
// the message dialog
FBLinkShareParams *params = [[FBLinkShareParams alloc] init];
params.link = [NSURL URLWithString:filePath];
params.name = #"My Video";
// If the Facebook app is installed and we can present the share dialog
if ([FBDialogs canPresentMessageDialogWithParams:params]) {
// Enable button or other UI to initiate launch of the Message Dialog
// Present message dialog
[FBDialogs presentMessageDialogWithLink:[NSURL URLWithString:#"https://developers.facebook.com/ios"] handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog([NSString stringWithFormat:#"Error messaging link: %#", error.description
]);
} else {
// Success
NSLog(#"result %#", results);
}
}];
} else {
// Disable button or other UI for Message Dialog
}
}
Is it possible (using the iOS SDK ) to send a message to a pre-known list of people? I'm using this syntax, from (https://developers.facebook.com/docs/ios/share#message-dialog):
[FBDialogs presentMessageDialogWithLink:[NSURL URLWithString:#"https://developers.facebook.com/docs/ios/"]
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog([NSString stringWithFormat:#"Error messaging link: %#", error.description]);
} else {
// Success
NSLog(#"result %#", results);
}
}];
From what I can tell, some usages of the share dialog support a to: parameter, but I don't see that here.
Edit: It really seems like the user picker dialog is not meant to be used in conjunction with the other messaging / sharing features of the SDK. This seems like a kind of absurd oversight.
Thanks!
I have an app that shares links to facebook. This link comes with a description and a caption. The problem I have is that the caption and description does not show up on facebook, sometimes a totally different caption is shown that I think is the site (link) description.
using facebookSDK this is how I share:
if ([FBDialogs canPresentShareDialogWithParams:params])
{
[FBDialogs presentShareDialogWithLink:params.link
name:params.name
caption:params.caption
description:params.description
picture:params.picture
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error)
{
if(error)
{
NSLog([NSString stringWithFormat:#"Error publishing story: %#", error.description]);
} else {
// Success
NSLog(#"result %#", results);
}
}];
}
I have another app that uses the same exact code and the caption shows just fine. I don't get it LOL help please
I'm trying to create a share button which share a post on Facebook. I've found this code below under Dialogs and UI controls on the Facebook developer page. It works just fine. The only problem is that after a few seconds on the Facebook post page it automatically goes back to the app without me clicking on anything. The below code is everything related to Facebook I've added, beside the plist Facebook app info.
How come it automatically returns to the app?
Code :
id<FBGraphObject> mealObject =
[FBGraphObject openGraphObjectForPostWithType:#"cooking-app:meal"
title:#"Lamb Vindaloo"
image:#"https://example.com/cooking-app/images/Lamb-Vindaloo.png"
url:#"https://example.com/cooking-app/meal/Lamb-Vindaloo.html"
description:#"Spicy curry of lamb and potatoes"];
id<FBOpenGraphAction> cookAction = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
[cookAction setObject:mealObject forKey:#"meal"];
[FBDialogs presentShareDialogWithOpenGraphAction:cookAction
actionType:#"cooking-app:cook"
previewPropertyName:#"meal"
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
NSLog(#"Error: %#", error.description);
} else {
NSLog(#"Success!");
}
}];
Hi I have the following problem.
If I share an facebook event url (like https://www.facebook.com/events/) from an iOS app I have two possibillities:
(1) iOS facebook app is installed
(2) iOS facebook app is not installed
I case 1 everything works just fine. The facebook app fetches the event information, shows up a right preview and also the post on the facebook wall is right.
In case 2 I use the FBWebDialods class and it shows up a preview without the picutre and also the post on the facebook wall is just text. No image and no attend button.
Has somebody an idea of how I can get the same resulting post on the facebook wall in both cases?
i get the response from https://developers.facebook.com/docs/ios/share/:
// Check if the Facebook app is installed and we can present the share dialog
FBShareDialogParams *params = [[FBShareDialogParams alloc] init];
params.link = [NSURL URLWithString:#"https://developers.facebook.com/docs/ios/share/"];
params.name = #"Sharing Tutorial";
params.caption = #"Build great social apps and get more installs.";
params.picture = [NSURL URLWithString:#"http://i.imgur.com/g3Qc1HN.png"];
params.description = #"Allow your users to share stories on Facebook from your app using the iOS SDK.";
// If the Facebook app is installed and we can present the share dialog
if ([FBDialogs canPresentShareDialogWithParams:params]) {
// Present the share dialog
} else {
// Present the feed dialog
}
and in Present the share dialog you add :
[FBDialogs presentShareDialogWithLink:params.link
name:params.name
caption:params.caption
description:params.description
picture:params.picture
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog([NSString stringWithFormat:#"Error publishing story: %#", error.description]);
} else {
// Success
NSLog(#"result %#", results);
}
}];
i hope this help you