Blakedallen Blakedallen - 2 years ago 85
Swift Question

Sending an animated Gif via sms in Swift

I'm trying to send an animated gif via the MFMessageComposeViewController in swift,

It seems to be working fine when I send the gif, however the preview shows a non-moving image. Any thoughts on how to make the preview animated?

let messageComposeVC = MFMessageComposeViewController()
let imgData = NSData(contentsOfURL: NSURL(string: "")!)
if imgData != nil {
messageComposeVC.addAttachmentData(imgData!, typeIdentifier: "com.compuserve.gif", filename: "animated.gif")
messageComposeVC.messageComposeDelegate = self
presentViewController(messageComposeVC, animated: true, completion: nil)

Answer Source

Upon further investigation, I now believe this is default iOS behavior, as with iMessages the same happens (gif shows as an image until sent, then begins animating).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download