通过电子邮件发送UIImage



假设我有一个存储在局部变量中的UIImage:

UIImage *myImage = (Some image extracted somewhere)

如何通过 MFMailComposeViewController 将此图像添加为附件?

图像不会存储在用户设备上,它只是在运行时可用。

所以我无法像其他问题/示例所证明的那样通过文件名访问此图像。

谢谢!

NSData *imageData = UIImageJPEGRepresentation(photo, 0.9);
NSString *attachmentName = @"Any name.jpg"
[mailer addAttachmentData:imageData mimeType:@"image/jpeg" fileName:attachmentName];

最新更新