Among the examples I have seen so far for iMessage-App extensions, I learned that the only way to send GIF is through creating a MSSticker and attaching a gif to it for sending. But, after observing some apps. I saw that GIPHY sends GIF through MSMessageTemplateLayout or MSMessageLayout. I know this because of how MSSticker and MSMessageLayout looks on the screen. You can see that in the images below:

This gif is <code>MSSticker</code>

This above image is gif inserted through MSSticker.

This gif is <code>MSMessageLayout</code>

This above image is gif inserted through MSMessageLayout.

The problem here is MSMessageLayout doesn't have any method to override. There is no way that I know by which we can insert gif into MSMessageTemplateLayout and make it play. I tried it. The only way I know is to create a custom MSMessageLayout which I don't find any examples for.

The major reason for me trying this method is:

  • There is 500 kb limit for size of GIF we can send through MSSticker
  • Through GIPHY, we can send a GIF with size greater than 500 kb. I checked it myself

So, two humble requests to the community:

  • If anyone already tried sending GIF through MSMessageLayout, please answer how you did it
  • If anyone succeded in sending GIF of size > 500 kb through MSSticker, please answer how you did it
1

There are 1 answers

0
Luca D'Alberti On BEST ANSWER

Usually when you send a MSMessage inside a MSMessageTemplateLayout, the app icon is shown on the top-left corner (in your screenshot, it doesn't appear) so this makes me think that they probably use insertAttachment(_:). In this way the media is handled automatically by iMessage as it has been sent via sharing from any other apps.