如何在 iPhone 应用程序的 Composer 表中添加 vcardfile

发布于 2024-08-20 10:03:34 字数 323 浏览 4 评论 0原文

在邮件表中,我可以添加图像,但我无法附加 vcard 文件

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker addAttachmentData:ExportVCF mimeType:@"text/x-vcard" 
                           fileName:@ "JOHNSMITH.vcf"];

,但当我发送邮件时,我没有收到附件

in the mail sheet im able to add images but where as im not able to attach vcard file

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker addAttachmentData:ExportVCF mimeType:@"text/x-vcard" 
                           fileName:@ "JOHNSMITH.vcf"];

but when i send a mail im not getting the attachment

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

意中人 2024-08-27 10:03:34

来自 MFMailCompserViewController 的文档:

指定数据的 MIME 类型。 (例如,JPEG 图像的 MIME 类型是
image/jpeg。)有关有效 MIME 类型的列表,请参阅
http://www.iana.org/assignments/media-types/。该参数不能为 nil。

如果您查看该链接,您可以看到所有有效的 MIME 类型,并且 text/x-vcard 未列出。我认为这意味着邮件编辑器视图控制器不会允许您附加具有无效(在它看来)MIME 类型的文件。

From the documentation for MFMailCompserViewController:

The MIME type of the specified data. (For example, the MIME type for a JPEG image is
image/jpeg.) For a list of valid MIME types, see
http://www.iana.org/assignments/media-types/. This parameter must not be nil.

If you look at the link, you can see all the valid MIME types, and text/x-vcard is not listed. I think this means that the Mail composer view controller isn't going to allow you attach a a file with an invalid (in it's opinion) MIME type.

时间海 2024-08-27 10:03:34

根据 2014 年 8 月 4 日 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];

在此处输入图像描述

As per the updates in MIME Types on 2014-08-04

http://www.iana.org/assignments/media-types/media-types.xhtml

vcard text/vcardformat will allow you to attach vcf-vcard file.

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];

enter image description here

阳光的暖冬 2024-08-27 10:03:34

基于Wikipedia vCard 页面进行更新:

vCard 的标准互联网媒体类型(通常称为其mime 类型)是:

text/vcard

从版本 4.0 规范开始,以前已知使用的其他媒体类型现已弃用,包括:

text/x-vcard
text/directory;profile=vCard
text/directory 

Update based on Wikipedia vCard page:

The standard Internet media type for a vCard (often referred to as its mime type) is:

text/vcard

As of version 4.0 specification, other media types known to have been used previously are now deprecated, including:

text/x-vcard
text/directory;profile=vCard
text/directory 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文