Reputation: 682
In my application i want to share only text on facebook. For that i am using FacebookSDK.
My Code for that is as below:
NSDictionary *params = @{
@"name" :[NSString stringWithFormat:@"Jinx Share"],
@"caption" : [NSString stringWithFormat:@""],
@"description" :@"Some text to share",
@"picture" : @"",
@"link" : @"",
};
// if the session is closed, then we open it here, and establish a handler for state changes
[FBSession openActiveSessionWithReadPermissions:nil allowLoginUI:YES completionHandler:^(FBSession *session,FBSessionState state, NSError *error)
{
if (error)
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:error.localizedDescription delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}
else if(session.isOpen)
{
// Invoke the dialog
[FBWebDialogs presentFeedDialogModallyWithSession:nil
parameters:params
handler:
^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
//NSLog(@"Error publishing story.");
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
//NSLog(@"User canceled story publishing.");
} else {
//NSLog(@"Story published.");
}
}}];
}
}];
But when facebook share dialogue opens, it does not show any text there. Please see below screenshot
And if i gave any link in "picture" parameter then it shows the text. But i don't want any image to be shown. I just want only text to share on facebook.
What is wrong with my code ? Could someone give me solution.
Upvotes: 1
Views: 548
Reputation: 3790
Since the latest Facebook SDK from the month of April, Facebook does not allow your app to pre-fill any content to be shared. This is inconsistent with Facebook Platform Policy, see Facebook Platform Policy, 2.3. Also refer this Sharing through Facebook.
Upvotes: 1
Reputation: 1383
This API is deprecated to share the pre-selected text in native Share dialogue. You can use Graph API with custom story to share the pre-selected text: Here is the link: https://developers.facebook.com/docs/sharing/opengraph/ios
Upvotes: 0