我正在尝试使用 MFMailComposeViewController 发送已添加到我的项目中的图像。
我在模拟器中尝试了此操作,效果很好,我还可以在文本字段中看到图像,但是当我尝试发送邮件时,我在控制台上收到以下错误:
Feb 10 16:22:02 markuss-macbook-pro.speedport.ip RMC Konus[1825] : CGImageCreate: invalid image size: 0 x 0.
我的代码:
//Get the Image
UIImage *image = [UIImage imageNamed:@"image.png"];
NSData *imageData = UIImagePNGRepresentation(image);
//Create the Mail View
MFMailComposeViewController *mailCV = [[MFMailComposeViewController alloc] init];
[mailCV setMailComposeDelegate:self];
[mailCV addAttachmentData:imageData mimeType:@"image/png" fileName:@"exGraphic.png"];
//Show the View Controller
[self presentViewController:mailCV animated:YES completion:nil];
最佳答案
问题仅出现在模拟器中。 我在许多不同的设备上检查了这些代码,它仍然可以正常工作。所以我想说,这是模拟器的问题......
关于iphone - 将图像添加到邮件时出错 - MFMailComposeViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14799908/