用SLRequest替换UIActivityViewController twitter post操作 [英] Replace UIActivityViewController twitter post action with a SLRequest

查看:112
本文介绍了用SLRequest替换UIActivityViewController twitter post操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试共享动画GIF,但默认的UIActivityViewController Twitter分享尚不支持,它将按比例缩小"作为静止的JPG,我必须按照

I am trying to share an animated GIF but default UIActivityViewController Twitter share doesn't support it yet which it will "scale down" it as a still JPG, I have to use SLRequest for it as taught in this article. The downside of that is no preview share sheet and users cannot type their own message anymore.

但是,我看到 SteppyPants 在用户单击Twitter共享表中的共享"后,似乎使用了自定义操作,他们该怎么做?

However, I saw SteppyPants that it seems using a custom action after users click "share" in Twitter share sheet, how can they do it?

换句话说,如何将UIActivityViewController twitter共享操作替换为包含SLRequest的自定义操作.

In other word, how to replace the UIActivityViewController twitter share action to a custom action which includes SLRequest.

我尝试过的事情:

  • UIActivityItemProvider并检查UIActivityTypePostToTwitter,但是 在用户单击twitter之后并在编辑文本之前运行
  • 在UIActivityViewController completeWithItemsHandler中,删除刚刚发呆的帖子(带有gif),然后使用SLRequest再次发布,但不太确定我是否可以删除旧帖子,而且无论如何,这都会消耗用户的网络带宽
  • SLComposeViewController,完全不支持动画GIF上传,也不支持自定义共享操作
  • UIActivityItemProvider and check UIActivityTypePostToTwitter, but that's run after user click twitter and before editing the text
  • In UIActivityViewController completionWithItemsHandler delete the just twitted post (with still gif) and post again with SLRequest, but not too sure if I can delete the old post and it's consuming network bandwidth for users anyway
  • SLComposeViewController, does not support animated GIF upload and not custom share action at all

P.S.我是iOS newb

P.S. I am iOS newb

推荐答案

UIActivityItemProvider并检查UIActivityTypePostToTwitter,但这在用户单击twitter之后并在编辑文本之前运行

UIActivityItemProvider and check UIActivityTypePostToTwitter, but that's run after user click twitter and before editing the text

那非常接近!

我相信Steppy Pants正在按照您说的做;为UIActivityViewController提供一个UIActivityItemProvider,但有所不同.

I believe Steppy Pants is doing what you said; providing a UIActivityItemProvider to the UIActivityViewController, but with a twist.

调用UIActivityItemProvideritem方法时,它将检查UIActivityType是否为UIActivityTypePostToTwitter,如果是,则取消UIActivityViewController并显示自定义的SLComposeServiceViewController.

When the UIActivityItemProvider's item method is called, it checks if the UIActivityType is UIActivityTypePostToTwitter and if so, the UIActivityViewController is dismissed and a custom SLComposeServiceViewController is presented.

如果仔细观察,您将看到:所显示的视图控制器没有标题,并且剩余字符数无法正确响应URL.然后,SLComposeServiceViewController对象实现didSelectPost来在启动SLRequest时呈现一个微调器UI.

If you look closely you can see: The presented view controller doesn't have a title and the remaining character count doesn't respond correctly to URLs. The SLComposeServiceViewController object then implements didSelectPost to present a spinner UI while it initiates an SLRequest.

这篇关于用SLRequest替换UIActivityViewController twitter post操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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