在邮件表中能够添加图像,但我无法附加vcard文件
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker addAttachmentData:ExportVCF mimeType:@"text/x-vcard"
fileName:@ "JOHNSMITH.vcf"];
但是当我发送邮件时我没有收到附件
答案 0 :(得分:1)
来自MFMailCompserViewController的文档:
指定数据的MIME类型。 (例如,JPEG图像的MIME类型是 image / jpeg。)有关有效MIME类型的列表,请参阅 http://www.iana.org/assignments/media-types/。此参数不得为零。
如果查看该链接,您可以看到所有有效的MIME类型,并且未列出text/x-vcard
。我认为这意味着邮件编辑器视图控制器不允许您附加一个文件,其中包含无效的(在它看来)MIME类型。
答案 1 :(得分:1)
根据2014-08-04中MIME类型的更新
http://www.iana.org/assignments/media-types/media-types.xhtml
vcard text/vcard
格式允许您附加vcf-vcard文件。
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
mailer.mailComposeDelegate = self;
[mailer setSubject:@"vCard"];
[mailer addAttachmentData:data mimeType:@"text/vcard" fileName:@"File.vcf"];
[self presentModalViewController:mailer animated:YES];
答案 2 :(得分:0)
根据Wikipedia vCard page更新:
vCard的标准Internet媒体类型(通常称为其mime类型)是:
text/vcard
从版本4.0规范开始,以前已使用的其他媒体类型现已弃用,包括:
text/x-vcard
text/directory;profile=vCard
text/directory