0

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self;

    [picker setMessageBody:@"Invoice Report Pdf File" isHTML:NO];



    NSMutableData *pdfData =[NSMutableData dataWithContentsOfFile:filePath];

    [picker addAttachmentData:pdfData mimeType:@"application/pdf" fileName:self.pdfName];
4

1 回答 1

1

根据我的代码更改 mime 类型,它会帮助你。

NSMutableData *pdfData = [NSMutableData data]; UIGraphicsBeginPDFContextToData(pdfData, bounds, nil);

然后在将来的某个时候,您需要将其传递pdfDataMFMailComposeViewController.

MFMailComposeViewController *vc = [[[MFMailComposeViewController alloc] init] autorelease]; [vc setSubject:@"my pdf"]; [vc addAttachmentData:pdfData mimeType:@"image/pdf" fileName:@"SomeFile.pdf"];
于 2012-10-17T13:59:50.453 回答