【发布时间】:2021-06-25 18:48:39
【问题描述】:
我正在尝试在不使用 Twitter 工具包库的情况下将 iOS 应用程序中的图像和标题共享到 Twitter。理想情况下,它应该与我附在这篇文章中的 Spotify 分享完全一样。对此有什么想法吗?
我浏览了 Twitter 文档,但在此主题上看不到太多内容。
我也尝试过使用 Apple 的 SLComposeViewController,但问题是图像在 Twitter 上显示为 URL 而不是图像:
if let vc = SLComposeViewController(forServiceType: SLServiceTypeTwitter) {
vc.setInitialText("some caption")
vc.add(UIImage(named: "my_image",
in: InternalConstants.bundle,
compatibleWith: nil)!)
vc.modalPresentationStyle = .formSheet
nc.present(vc, animated: true)
}
请不要将此问题标记为重复,除非解决方案提供即时深层链接,如所附 gif 所示。
谢谢!
【问题讨论】:
-
请分享您的代码以及到目前为止您尝试了什么
-
@zeytin 更新了问题。谢谢。
-
嘿@KirillKudaev 你得到答案了吗?
-
@MojtabaHosseini 我做到了。谢谢!
-
很高兴听到这个消息!如果它是您的答案,请不要忘记将其标记为答案:)
标签: ios swift twitter deep-linking sharing