Facebook SLComposeViewController URL显示在正文,如果URL和图像存在 [英] Facebook SLComposeViewController URL shows up in body if both URL and image present
问题描述
使用 SLComposeViewController
,如果图像和URL都存在,我注意到发布到Facebook的好奇行为。具体来说,如果您同时拥有图像和URL,则URL将出现在Facebook的正文中,视图中的 SLComposeViewController
,紧跟在 initialText之后
如果我执行以下操作:
Using SLComposeViewController
, I notice curious behavior when posting to Facebook if both the image and the URL are present. Specifically, if you have both image and URL, the URL appears in the body of the Facebook post in the view of the SLComposeViewController
, immediately after the initialText
if I do the following:
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的后面部分:
That's obviously a hassle because the if the URL is long, the initial text is pushed off of the visible portion of the view of SLComposeViewController
and I only see the latter portion of the URL:
如果我重复此过程,此时不添加图像到帖子,URL的文本方便地不显示在身体中(即使它在网上正常显示)。
If I repeat this process, this time not adding the image to the post, the text of the URL conveniently does not show up in the body at all (even though it shows up properly online).
底线,只有有图像和,URL会显示在帖子的正文中。当我使用 FBNativeDialogs
时,我看到了相同的模式。
Bottom line, only if there is an image and and URL does the URL show up in the body of the post. And I see this same pattern when I use FBNativeDialogs
.
有什么办法可以用 SLComposeViewController
,以便我可以将图像和URL都连接到Facebook的帖子,而不会将用户暴露在网站的长而丑的URL中?显然,我可以使用任何非 - code> SLComposeViewController 解决方案(例如设计我自己的用户界面来撰写Facebook的帖子,使用Facebook已弃用的 Feed对话框等)。只是想知道我是否忽略了一些明显的 SLComposeViewController
解决方案。
Is there any way to stop that behavior with SLComposeViewController
, so that I can have both image and URL connected to the Facebook post without exposing the user to the web site's long, ugly URL? Clearly I can use any of the non-SLComposeViewController
solutions (e.g. design my own UI for composing the Facebook post, using Facebook's deprecated Feed Dialog, etc.). Just wondering if I'm overlooking some obvious SLComposeViewController
solution.
推荐答案
最后,我放弃了 SLComposeViewController
(以及 FBNativeDialogs
)。他们提供了一个很好的综合感觉,但由于我的帖子总是包括照片和URL,这真的不起作用。除此之外,这些帖子没有被正确归因于我的应用程序。
In the end, I've given up on the SLComposeViewController
(as well as the FBNativeDialogs
). They present a nice, integrated feel, but given that my posts invariably include both photo and URL, this really doesn't work. On top of that, the posts were not correctly attributed as being from my app.
所以,最后我写了自己的用户界面,并使用了Facebook SDK 3.1 FBRequestConnection
如 here 所述。我认为这是一个有点愚蠢,我们都必须制作自己的UI,因为本机UI的弱点,但它是什么。
So, in the end, I've written my own user interface and use the the Facebook SDK 3.1 FBRequestConnection
as outlined here. I think it's a little silly that we all have to make our own UI because the weaknesses in the native UI, but it is what it is.
这篇关于Facebook SLComposeViewController URL显示在正文,如果URL和图像存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!