无法使用 SLComposeViewController 在 Twitter 上共享图像和文本

Rob*_*Rob 5 twitter ios slcomposeviewcontroller swift

我只是这样做:

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

我在我的应用程序中这样做已经很长时间了,它曾经工作得很好,但我最近才意识到它不再工作了。现在,仅显示图像,文本部分为空。那么……发生了什么事,该怎么办?

ARG*_*Geo 3

尝试使用TWTRComposer\xc2\xa0 而不是 \xc2\xa0 SLComposeViewControllerTwitterKit提供了具有相同功能的轻量级\xc2\xa0 TWTRComposer\xc2\xa0,并封装了授权用户(如果您的应用程序没有显式登录功能)。

\n\n
let vc = TWTRComposer()\nvc.setText("Tweet text")\nvc.setImage(UIImage(named: "hi"))\nvc.setUrl(URL(string: "https://dev.twitter.com"))\nvc.show(from: self, completion: nil)\n
Run Code Online (Sandbox Code Playgroud)\n\n

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

\n