【发布时间】:2013-09-15 15:56:23
【问题描述】:
我正在使用SLComposeViewController 在 Twitter 和 Facebook 上发帖。我对 twitter 和 facebook 都有相同的代码,但是 URL 没有显示在 twitter 帖子中。我该如何解决这个问题?
推特代码 -
socialController = [SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeTwitter];
[socialController setInitialText:@"Testing: This is the app link!"];
[socialController addImage:[UIImage imageNamed:@"image.jpg"]];
[socialController addURL:[NSURL URLWithString:@"http://www.google.com"]];
[self presentViewController:socialController animated:YES completion:nil];
Facebook 代码 -
socialController = [SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeFacebook];
[socialController setInitialText:@"Testing: This is the app link!"];
[socialController addImage:[UIImage imageNamed:@"image.jpg"]];
[socialController addURL:[NSURL URLWithString:@"http://www.google.com"]];
[self presentViewController:socialController animated:YES completion:nil];
【问题讨论】:
-
很确定这就是它的工作原理。您在 Tweet 对话框中看到的小回形针意味着附加了一个链接。 Facebook 没有供您同时上传图片和分享链接的 API,因此链接必须放在消息正文中。
-
我还没有使用 addURL 但这可以帮助您:如果您想在推文文本中看到它,请尝试将链接添加到 initialText:[socialController setInitialText:[NSString stringWithFormat:@"测试:这是应用链接!%@", tweetURL]];
标签: iphone ios facebook twitter slcomposeviewcontroller