In my iOS app, I would like to enable users to tweet GIFs.
I have a working TWTRComposer and tried attaching a GIF by using the SetImage method:
[composer setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:self.localGifURL]]];
The image then appears in the composer view, but when the image gets posted to Twitter, it's a static image rather than a GIF.
Is it possible to attach a GIF to a tweet created with TWTRComposer?
Edit
I tried integrating this library to create an animated UIImage:
https://github.com/mayoff/uiimage-from-animated-gif
Updating my code, I have the following:
[composer setImage:[UIImage animatedImageWithAnimatedGIFURL:self.localGifURL]];
But this still results in a static image on Twitter.
Edit #2
One other observation - if I save the GIF to my phone and try to share it on Twitter directly from the Photo library (which opens up what looks to be a TWTRComposer window), it posts as an image, not a GIF. Which leads me to that you may not be able to attach a GIF to a TWTRComposer...
I don't believe that the TWTRComposer currently supports animated GIF or video attachments. I think you'd have to call the media/upload
REST API endpoint directly to post the attachment, and then use the statuses/update
method to attach them to a Tweet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With