Iphone MFMailComposeViewController添加空内容Id

Iphone MFMailComposeViewController添加空内容Id,iphone,Iphone,这是我第一次在小组中发表文章,所以请友善:) 我正在从我的应用程序发送几个音频附件,如下所示: MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self; picker.modalPresentationStyle = UIModalPresentationCurrentContext; [picker setSub

这是我第一次在小组中发表文章,所以请友善:)

我正在从我的应用程序发送几个音频附件,如下所示:

 MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
 picker.mailComposeDelegate = self;
 picker.modalPresentationStyle = UIModalPresentationCurrentContext;
 [picker setSubject:@"Test message"]; 
 NSArray *toRecipients = [NSArray arrayWithObject:@"foo@bar.com"];
 [picker setToRecipients:toRecipients];

 // multiple attachments are made as follows
  NSData *myData = [NSData dataWithContentsOfFile:filePath];
 [picker addAttachmentData:myData mimeType:@"audio/x-caf" fileName:fileName];

 [picker setMessageBody:@"test message" isHTML:NO];

 [controller presentModalViewController:picker animated:YES];
mailComposeController方法负责取消模态视图

不幸的是,当消息被传递时,附件的mime头会将内容Id设置为null。下面是它的外观:

 Content-Type: audio/x-caf; name="audio_1.caf"
 Content-Transfer-Encoding: base64
 Content-Id: <(null)>
 Content-Disposition: attachment; filename="audio_1.caf"
内容类型:音频/x-caf;name=“audio_1.caf”
内容传输编码:base64
内容Id:
内容处置:附件;filename=“audio_1.caf”
如果我手动删除内容Id字段并在Mac Mail程序(邮件版本3.6)中重新加载邮件,附件将正确显示。换句话说,我并不真的需要/希望在mime头中插入内容Id

另外,值得一提的是,出于调试目的,如果我将mime类型设置为“image/jpeg”,mime头将获得有效的内容Id字符串。我的所有附件都显示在邮件中。正如预期的那样,在这种情况下,附件无法在Mac或iPhone上正确打开

任何帮助都将不胜感激

谢谢,
apurva

根据这篇文章,您不能手动设置
内容ID

好的。我想起来了,这是偶然的

空内容ID似乎是由邮件服务器插入的(不是我的应用程序或MFMailComposeViewController)

最初我是用个人雅虎账户测试发送。那就是我遇到问题的时候。当我转到我的工作帐户时,问题消失了

谢谢, 阿普瓦