0

I've got an app I'm working on that uses mfmailcomposeviewcontroller to create an email with an attached PDF.

In iOS 10, I've found that the "preview" of the PDF now shows up as blank:

enter image description here

The mail composer used to display as a preview of the PDF in the email without any issue up until iOS 9. If I send the email, the PDF is still attached and working just fine. Is this an issue with the Apple Mail app on iOS 10, or is there something else going on with the MFMailCompose? I've attached my code below:

NSData *immutableData = [NSData dataWithData:pdfData];
        MFMailComposeViewController *mail=[[MFMailComposeViewController alloc]init];
mail.mailComposeDelegate = self;
[mail setSubject:@"Attachment Issue"];
[mail addAttachmentData:immutableData mimeType:@"image/pdf" fileName:@"Report.pdf"];
NSString * body = @"iOS 10 vs iOS 9";
[mail setMessageBody:body isHTML:NO];
[self presentViewController:mail animated:YES completion:nil];
  • I should also add that changing the mimetype to mimeType:@"application/pdf" will allow the mail composer to show this as an attachment, but I am for the most part still curious as to whether the preview is salvageable. – Trevor Record Sep 19 '16 at 18:13
  • Update: I uploaded this as a bug to apple, but it was closed... seems like they now consider "image/pdf" to be an invalid mimeType, even though it was previously displayed in older iOS version, and is considered valid by other email clients. My best advice is switch to "application/pdf", and create a view to display a preview of your PDF in to confirm before your email comes up, if you want your app users to be able to see your PDF. – Trevor Record Sep 30 '16 at 22:45

0 Answers0