在我的应用中,我有一个button
按下时会显示一个预先填充了主题,消息正文和jpg的MFMailComposeViewController
。但是,我注意到一些奇怪的行为。 MFMailComposeViewController
通常会显示消息正文和图像,但有时会显示消息正文和图像附件,但主题始终正确显示。我正在iOS 8
上运行我的应用。我的代码如下。任何建议/意见将不胜感激。
- (void)emailButtonPressed:(id)sender {
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"My Subject"];
[picker setMessageBody:[NSString stringWithFormat:@"My Message Body"] isHTML:YES];
NSData *imageData = UIImageJPEGRepresentation(self.image, 1.0);
NSString *fileName = @"myFileName";
fileName = [fileName stringByAppendingPathExtension:@"jpeg"];
[picker addAttachmentData:imageData mimeType:@"image/jpeg" fileName:fileName];
[self presentViewController:picker animated:YES completion:nil];
}