【发布时间】:2012-10-03 17:53:16
【问题描述】:
使用SLComposeViewController,如果图像和 URL 都存在,我在向 Facebook 发帖时会注意到奇怪的行为。具体来说,如果您同时拥有图像和 URL,则 URL 将出现在 SLComposeViewController 视图中的 Facebook 帖子正文中,紧跟在 initialText 之后,如果我执行以下操作:
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
NSString *text = @"This is a test Facebook post with SLComposeViewController.";
NSURL *url = [NSURL URLWithString:@"http://http://stackoverflow.com/questions/12503287/tutorial-for-slcomposeviewcontroller-sharing"];
UIImage *image = ...;
[controller setInitialText:text];
[controller addURL:url];
[controller addImage:image];
[self presentViewController:controller animated:YES completion:nil];
这显然很麻烦,因为如果 URL 很长,初始文本会被推离 SLComposeViewController 视图的可见部分,而我只能看到 URL 的后半部分:
如果我重复这个过程,这次不将图像添加到帖子中,URL 的文本根本不会方便地显示在正文中(即使它在网上正常显示)。
底线,只有当有图片 和 和 URL 时,URL 才会显示在帖子的正文中。当我使用FBNativeDialogs 时,我看到了同样的模式。
有什么方法可以通过SLComposeViewController 阻止这种行为,这样我就可以将图像和 URL 都连接到 Facebook 帖子,而不会让用户看到该网站又长又丑的 URL?显然,我可以使用任何非SLComposeViewController 解决方案(例如,设计我自己的 UI 来撰写 Facebook 帖子,使用 Facebook 已弃用的 Feed Dialog 等)。只是想知道我是否忽略了一些明显的SLComposeViewController 解决方案。
【问题讨论】: