Monday, July 18, 2022

[FIXED] How to add gif to attachment in iPhone mail?

Issue

I add .jpg this way:

UIImage *sentPic = self.image;
NSData *imageData = UIImageJPEGRepresentation(sentPic, 1);
[picker addAttachmentData:imageData mimeType:@"image/jpg" fileName:@"pic.jpg"];

I change it to "image/gif".But it doesn't work fine. Th Gif is just a still image in the mail.


Solution

NSData *imageData = [[NSData alloc] initWithContentsOfFile:pathToGifFile];
[picker addAttachmentData:imageData mimeType:@"image/gif" fileName:@"pic.gif"];
[imageData release];

This would add it as attachment, but I'm not sure if that's what you want, or you want to display the image inside the message?



Answered By - Filip Radelic
Answer Checked By - Pedro (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.