Create a MFMailComposeViewController
and call addAttachmentData:mimeType:fileName:
. The data will be the PDF you created. The mimeType will be application/pdf
. And the fileName will be the name of the file in the email attachment. The code might look like something below:
From the tutorial you'll need to render your PDF into a NSMutableData object:
NSMutableData *pdfData = [NSMutableData data];
UIGraphicsBeginPDFContextToData(pdfData, bounds, nil);
Then at some point in the future you'll need to pass that pdfData to the MFMailComposeViewController
.
MFMailComposeViewController *vc = [[[MFMailComposeViewController alloc] init] autorelease];
[vc setSubject:@"my pdf"];
[vc addAttachmentData:pdfData mimeType:@"application/pdf" fileName:@"SomeFile.pdf"];