views:

120

answers:

1

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

A: 

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.

Jasarien
can anyone tel me what is the valid mime type for vcard
Pinky
i also tried multipart/alternative,application/vcfit did not attach the vcard in mail whenn send
Pinky
The only one I could find was http://www.iana.org/assignments/media-types/application/vnd.groove-vcard which was registered by an application called Groove. It may work, it may not work. I'm not sure if this is the same kind of vcard you're referring to or if it just happens to have the same name...
Jasarien