iOS: FBSDKShareDialog custom message
Asked Answered
F

2

5

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()];
Fowle answered 30/3, 2015 at 14:36 Comment(0)
E
10

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

Erigeron answered 31/3, 2015 at 0:10 Comment(2)
Why do they put this in the SDK if it is no longer allowed? Any Ideas?Slake
I'm not sure what you mean, there's no way to specify the message in the SDK. You can still share a link, you just can't prefill the user message.Erigeron
W
1

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";
Whiteley answered 30/8, 2016 at 8:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.