我使用 MFMailComposeViewController 发送生成的报告(csv)。
现在邮件被发送到:电子邮件ID,但是当我检查邮件时,我确实收到了邮件,但附件不存在。
然后我还尝试了 MailComposer 示例:
https://developer.apple.com/iphone/library/samplecode/MailComposer/index.html
其中 png 图像附加到邮件演示。我也使用该应用程序发送了邮件,但没有发送相同的结果图像附件。
帮忙看看是什么问题?提前致谢。
这是该应用程序中的代码:
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Hello from California!"];
// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@"first@example.com"];
NSArray *ccRecipients = [NSArray arrayWithObjects:@"second@example.com", @"third@example.com", nil];
NSArray *bccRecipients = [NSArray arrayWithObject:@"fourth@example.com"];
[picker setToRecipients:toRecipients];
[picker setCcRecipients:ccRecipients];
[picker setBccRecipients:bccRecipients];
// Attach an image to the email
NSString *path = [[NSBundle mainBundle] pathForResource:@"rainy" ofType:@"png"];
NSData *myData = [NSData dataWithContentsOfFile:path];
[picker addAttachmentData:myData mimeType:@"image/png" fileName:@"rainy"];
// Fill out the email body text
NSString *emailBody = @"It is raining in sunny California!";
[picker setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:picker animated:YES];
[picker release];