Error with attaching large PDF to mail composer iO

2020-07-26 12:10发布

问题:

My application generates a PDF and attaches the PDF to an email using MailComposerViewController. This part is working fine. In iOS 9.1 no matter the size of the PDF (15~mb) it attaches and sends properly.

However it seems in iOS 9.2.1 I have a problem attaching large PDF's to an email. If I cut my PDF down to about 4-5 pages and keep it at a few megabytes it works fine. However if I generate the entire PDF (over 100 pages about 16mb) the email that comes into my inbox is completely blank.

If I open the mail app in the iPad (air) and look in the sent box there is an error message in the body of the email that says "This message cannot be displayed because of the way it is formatted. Ask the sender to send it again using a different format or email program. multipart/alternative"

Testing on my iPad 4 with 9.2.1 I see a different error. In the mail app outbox the message appears stuck with a red exclamation point. If I resend the email from the mail app, it works and I can open the PDF in my email.

I've even gone as far as adding simple PDF's to my bundle and attaching it, completely eliminating my generating of the PDF file. If the PDF is large, it doesn't send properly. If it's small, it sends.

I'm not sure where to go from here so any idea's would be great. Thanks!