[英]How do I add vcardfile in the composer sheet of an iPhone application
在郵件表中,我無法添加圖像,但無法添加電子名片文件
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker addAttachmentData:ExportVCF mimeType:@"text/x-vcard"
fileName:@ "JOHNSMITH.vcf"];
但是當我發送郵件時我沒有收到附件
從MFMailCompserViewController的文檔中:
指定數據的MIME類型。 (例如,JPEG圖像的MIME類型為image / jpeg。)有關有效MIME類型的列表,請參見http://www.iana.org/assignments/media-types/ 。 此參數不能為nil。
如果您查看鏈接,則可以看到所有有效的MIME類型,並且未列出text/x-vcard
。 我認為這意味着Mail composer視圖控制器將不允許您附加無效的MIME類型的文件。
根據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];
根據Wikipedia vCard頁面進行更新:
vCard的標准Internet媒體類型(通常稱為其mime類型)為:
text/vcard
從版本4.0規范開始,不建議使用以前已知的其他媒體類型,包括:
text/x-vcard
text/directory;profile=vCard
text/directory
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.