iOS: FBSDKShareDialog自定义消息

5
我正在创建FBSDKShareLinkContent对象,并将其提供给FBSDKShareDialog。我尝试设置对话框的默认消息为“我的高分是%d!”。分享本身正在工作,并具有默认情况下为空的消息。可以有人帮助吗?
谢谢!
编辑:这是我的代码片段:
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()];
2个回答

10

使用SDK提供的共享对话框没有设置默认消息的方法。这也被认为是预填充,并且违反了Facebook平台政策,请参见2.3节https://developers.facebook.com/policy


如果不再允许,为什么他们还要把它放在SDK中?有什么想法吗? - justColbs
我不确定你的意思,SDK 中没有指定消息的方法。你仍然可以分享链接,只是无法预填用户消息。 - Ming Li

1
我发现标题和描述与URL对象有关。这意味着在共享对话框中用户看到的对象上方的消息文本似乎不会受到影响。
只有在将对话框模式设置为Native或FBSDKShareDialogModeFeedBrowser时,URL对象的标题和描述才起作用。
dialog.mode = FBSDKShareDialogModeNative;
if (![dialog canShow]) {
    dialog.mode = FBSDKShareDialogModeFeedBrowser;
}

另外一件事是,有一些名为“quote”的FBSDKShareLinkContent属性,它会显示一些文本在URL对象上方和消息本身下方,但并不在所有模式下都显示。例如,在原生模式下不显示,但在FBSDKShareDialogModeFeedBrowser中显示。
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:@"http://www.x.com"];
content.contentDescription = @"desc";
content.contentTitle = @"title";
content.quote = @"quote";

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接