Iphone 不接收从MFMailComposer发送的附件

Iphone 不接收从MFMailComposer发送的附件,iphone,email,sdk,attachment,mfmailcomposeviewcontroller,Iphone,Email,Sdk,Attachment,Mfmailcomposeviewcontroller,我正试图在iPad上发送一封带有.csv附件的电子邮件。根据下面显示的许多示例,我正在使用MFMailComposer。发送电子邮件时,我可以在MFMailComposer窗口中看到正确的文件附件,但当我收到电子邮件时,没有任何附件。任何关于我可能做错什么的指导都将不胜感激。谢谢你抽出时间 if ([MFMailComposeViewController canSendMail]) { MFMailComposeViewController *mailViewController =

我正试图在iPad上发送一封带有.csv附件的电子邮件。根据下面显示的许多示例,我正在使用MFMailComposer。发送电子邮件时,我可以在MFMailComposer窗口中看到正确的文件附件,但当我收到电子邮件时,没有任何附件。任何关于我可能做错什么的指导都将不胜感激。谢谢你抽出时间

if ([MFMailComposeViewController canSendMail]) {

    MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
    mailViewController.mailComposeDelegate = self;
    [mailViewController setSubject:[NSString stringWithFormat:@"Results for Participant %d.", [delegate participantNumber]]];
    [mailViewController setMessageBody:[NSString stringWithFormat:@"The results for Participant %d in Study: %@ are as follows:", [delegate participantNumber], [[delegate getAccountData:([delegate accountItems] * [delegate accountNumberInUse])] description]] isHTML:NO];

    NSData *textData = [[NSData alloc] initWithContentsOfFile:dataFileName];
    [mailViewController addAttachmentData:textData mimeType:@"text/csv" fileName:[NSString stringWithFormat:@"Participant_Info_#%d.csv", [delegate participantNumber]]];

    [self presentModalViewController:mailViewController animated:YES];
    [mailViewController release];

} 

检查textData变量的内容,并且(仅从代码中猜测)dataFileName需要包含文件的完整系统路径,而不仅仅是它的名称

NSString *dataFilePath = [[NSBundle mainBundle] pathForResource:dataFileName ofType:nil];

您是否在已发送邮箱文件夹中看到附件?也不是真的与问题有关,但我认为你错过了一个文本数据发布在最后。