iOS native share to Twitter converts shared animated GIFs to JPEG



Hi! It used to be possible to share animated GIFs from other apps to the Twitter app, but after a change late last year (somewhere between mid-October and early December), the animated GIFs shared are now converted to JPEG and posted to / with content-type application/octet-stream. To be fair, the old behavior was a bit weird (it posted the GIF binary to the same endpoint, but with an incorrect content type of image/jpeg), but at least the result was that the GIF was tweeted correctly and did auto-play in the feed.

Here’s a snippet demonstrating the issue:

- (void)viewDidAppear:(BOOL)animated {

 NSString *path =
     [[NSBundle mainBundle] pathForResource:@"game" ofType:@"gif"];

 NSData *gifData = [NSData dataWithContentsOfFile:path];

 NSArray *objectsToShare = @[ gifData ];

 UIActivityViewController *activityVC =
     [[UIActivityViewController alloc] initWithActivityItems:objectsToShare

 [self presentViewController:activityVC animated:YES completion:nil];

Here’s a sample Tweet that used the old app.
Here’s a sample from the new one.

As you can tell, the animation is lost in the new one due to the conversion to JPEG.


no solution?