Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: FBSDKShareDialog custom message

I'm creating the FBSDKShareLinkContent object and feeding it into the FBSDKShareDialog. I'm trying to set up the dialog's default message to something like "my highscore is %d !". sharing itself is working and has an empty message by default. can anyone help please?

thank you!

EDIT: here is my piece of code:

FBSDKShareLinkContent* content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString: @"https://itunes.apple.com/us/app/cylinder-game"];
content.contentTitle = @"Cylinder Game";
content.contentDescription = @"Cylinder Game is endless, rhythm based game with super addictive gameplay";

FBSDKShareDialog* dialog = [[FBSDKShareDialog alloc] init];
[dialog setMode:FBSDKShareDialogModeAutomatic];
[dialog setShareContent:content];
[dialog setDelegate:self];
[dialog setFromViewController:UnityGetGLViewController()];
like image 910
Nika Kasradze Avatar asked Mar 30 '15 14:03

Nika Kasradze


2 Answers

There's no way to set the default message using the share dialog offered by the SDK. It's also considered prefilling, and is against the Facebook Platform Policy, see section 2.3 https://developers.facebook.com/policy

like image 86
Ming Li Avatar answered Oct 27 '22 00:10

Ming Li


I found that the title and description is related to url object anyway. That means the text of message above the object, which user see in share dialog cannot be affected it seems.

And the title and descripton of URL object only works if you set the dialog mode to Native or FBSDKShareDialogModeFeedBrowser.

dialog.mode = FBSDKShareDialogModeNative;
if (![dialog canShow]) {
    dialog.mode = FBSDKShareDialogModeFeedBrowser;
}

Another thing is, there is some property of FBSDKShareLinkContent called "quote", which displays some text above URL object and under message itself, but it is not displayed in all modes. For example not in Native, but yes in FBSDKShareDialogModeFeedBrowser.

FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:@"http://www.x.com"];
content.contentDescription = @"desc";
content.contentTitle = @"title";
content.quote = @"quote";
like image 25
luky Avatar answered Oct 26 '22 23:10

luky