【问题标题】:SLComposeViewController doesn't attach image to twitter if image is larger than 100kb如果图像大于 100kb,SLComposeViewController 不会将图像附加到 twitter
【发布时间】:2017-10-27 11:21:13
【问题描述】:

我尝试使用以下代码将带有文本的图像发布到 Twitter:

SLComposeViewController *tweetController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
[tweetController setInitialText:@"Hello this is a tweet. #somehastag #https://appstore.com/someurl"];
[tweetController addImage:[UIImage imageNamed:@"image.png"]];
[self presentViewController:tweetController animated:YES completion:Nil];


但有时图像没有显示在对话框中,也没有发布到 Twitter。 [UIImage imageNamed:@"image.png"] 始终返回不为零,tweetController addImage 始终返回 YES。但图像并不总是成功附加。

深入研究这个问题,我发现当图像大于 100kb 时,它不会附加图像

我在 iOS9 上使用 1193x1193px 的 png 图片。

你有什么解决办法吗?

【问题讨论】:

    标签: ios image twitter share slcomposeviewcontroller


    【解决方案1】:

    我使用 jpeg 图像而不是 png 来解决这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-05
      • 2022-01-07
      相关资源
      最近更新 更多