【发布时间】:2011-11-30 13:16:21
【问题描述】:
这是我在小组的第一篇文章,所以请善待:)
我正在从我的应用发送几个音频附件,如下所示:
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 标头着陆时 Content-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"
如果我手动删除 Content-Id 字段并在我的 Mac 邮件程序(邮件版本 3.6)中重新加载邮件,附件会正确显示。换句话说,我真的不需要/不希望将 Content-Id 插入到 mime 标头中。
此外,值得一提的是,出于调试目的,如果我将 mime 类型设置为“image/jpeg”,则 mime 标头确实会获得有效的 Content-Id 字符串。我所有的附件都显示在邮件中。不出所料,在这种情况下,附件无法在 Mac 或 iPhone 上正确打开。
任何帮助将不胜感激。
谢谢, 阿普尔瓦
【问题讨论】:
标签: iphone