无法使用SLComposeViewController在Twitter上共享图像和文本 [英] Cannot share both image and text on Twitter using SLComposeViewController

查看:94
本文介绍了无法使用SLComposeViewController在Twitter上共享图像和文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是这样做:

if let vc = SLComposeViewController(forServiceType: SLServiceTypeTwitter) {
    vc.setInitialText("Tweet text")
    vc.add(image)
    present(vc, animated: true)
}

我已经在我的应用程序中做了很长时间了,它过去可以正常工作,但是最近我才意识到它不再起作用了.现在,仅显示图像,文本部分为空. 那么...发生了什么,该怎么办?

I've done this in my app for a long time now and it used to work fine, but I just realized recently it doesn't work anymore. Now, only the image is being displayed, the text section is empty. So... what happened, what to do?

推荐答案

尝试使用TWTRComposer而不是SLComposeViewController. TwitterKit 提供具有相同功能的轻量级TWTRComposer,如果您的应用程序没有显式登录功能,则封装授权用户.

Try using TWTRComposer instead of SLComposeViewController. TwitterKit provides a lightweight TWTRComposer with the same capabilities and encapsulates authorising users if your application doesn't have explicit log in functionality.

let vc = TWTRComposer()
vc.setText("Tweet text")
vc.setImage(UIImage(named: "hi"))
vc.setUrl(URL(string: "https://dev.twitter.com"))
vc.show(from: self, completion: nil)

您可以在此处下载TwitterKit: https://dev.twitter.com/twitterkit/ios/overview .

You can download TwitterKit here: https://dev.twitter.com/twitterkit/ios/overview.

这篇关于无法使用SLComposeViewController在Twitter上共享图像和文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆