11

I want to send a vCard via simple SMS. I do not intend to send vCard with iMessage of Email.

I've created a vCard in the format below.

BEGIN:VCARD
VERSION:3.0
N:;Sahil;;;
FN:Sahil
EMAIL;type=INTERNET;type=HOME:s.k@yahoo.com
TEL;type=CELL:98-76-543210
END:VCARD

I'm trying to send the above in MFMessageComposeViewController. When I send the message, the other device receives it as a simple SMS.

I want to know if its possible to send a vCard via normal SMS in iPhone? If yes, is there some encoding I need to follow?

Note: Just an information on how vCard is sent from a BlackBerry device

sms.setPayloadData(card.getBytes("ISO-8859-1"));

Screenshot of SMS app

Sahil Khanna
  • 4,262
  • 8
  • 47
  • 72
  • I think you are confusing the `FN` and `N` properties. `N` stores the components of the person's name, separated by semi-colons. `FN` defines how the person's name should be displayed. In vCard version 3.0, both of these properties are required. Also, the `TEL` property in your example has an incorrect value for the `TYPE` parameter. The correct value is "CELL", not "MOBILE". – Michael Dec 10 '12 at 13:55
  • @Michael I used code from http://altoshstock.blogspot.in/2010/11/iphone-os-generate-vcard.html and tried sending the vCard. Still the same issue... Refer to the updated question with the corrections you pointed. – Sahil Khanna Dec 11 '12 at 04:50
  • You are missing the `BEGIN` and `END` properties in your screenshot. – Michael Dec 11 '12 at 14:39
  • The BEGIN and END tags couldn't be visible due to iOS Message app UI constraints. The contents are same as the format mentioned in the question (including the BEGIN/END tags). – Sahil Khanna Dec 11 '12 at 18:15
  • Have you found a solution yet? I'm working on the exact same problem – esreli Jun 24 '13 at 03:51
  • I did not find a solution. I got involved with other tasks and may rework on this at some later time – Sahil Khanna Oct 23 '13 at 10:43

3 Answers3

5

What you are trying to do is not possible. You can only send plain text via the public API of MFMessageComposeViewController. No attachments or alternate content is currently supported.

Cocoanetics
  • 8,171
  • 2
  • 30
  • 57
1

Check possible answers for your questions here:

Send location information or vCard through SMS on iPhone

Creating a vCard in iPhone

how can I send vCard through sms message in code?

https://github.com/aussiegeek/AddressBookVcardImport

http://www.developerfeed.com/objectivec/howto/how-generated-vcard-using-objectivec-iphone

Community
  • 1
  • 1
Lalith B
  • 11,843
  • 6
  • 29
  • 47
  • I've already tried the first 3 links. 4th: Its a vCard import app. I need an app to send vCard. 5th: similar to the links above. :. problem not solved. – Sahil Khanna Dec 20 '12 at 08:42
  • I found this helpful. You might want to digg the code of this app. For sending vCard as sms you just need to follow encoding styles and send as text message : Read link below. http://www.mosycon.com/SMSCard https://github.com/gordonhuang/RHAddressBook – Lalith B Dec 20 '12 at 08:48
  • I ran through the code but could not find the SMS sending part... Can you be more specific on the encoding styles? I've tried NSUTF8StringEncoding, NSISOLatin1StringEncoding, NSASCIIStringEncoding but failed. – Sahil Khanna Dec 20 '12 at 09:04
  • save the file as .vcf with plain text and send sms with reading the contents of the file by the first link. When user clicks send button it will be recieved as a vcard in other mobile phones. – Lalith B Dec 20 '12 at 09:21
  • I guess what you are trying is to send a file through sms(That is a MMS/Multimedia Message), which obviously is not possible through code that is via public api exposed by apple. REF : http://blog.mugunthkumar.com/coding/iphone-tutorial-how-to-send-in-app-sms/ – Lalith B Dec 20 '12 at 12:16
  • If you go through the question, I want to send the contact details (in vCard format) via SMS and not MMS or Email. Look at the screenshot as well where you can see only text and no attachment (file). – Sahil Khanna Dec 20 '12 at 12:27
  • This last message is very enlightening, Sahil :) – Tom Pace Dec 21 '12 at 03:08
0

I'm going to chime in an answer.

Unlikely ... but it's still uncertain because lacking further details of your whole end-to-end expectation, ie device receiving vcard. You mentioned the BinaryMessage setPayload() method from the BlackBerry API.

Sahil, after reading your very good comments and everyone's back-and-forth, I understand now you are intending to have the message be received specifically via SMS and not MMS.

You're expecting the sending device to use SMS, and so implicitly expect the recipient device to receive a string of text, and without wanting to break it appart from other parts in a multi-part message. An in-coming SMS message with special contents can be parsed by a messaging app listening for incoming data, and in the case of iOS, it can render web links and phone numbers within SMS text as active links. But I don't know that any mobile phone platform supports vcard in this manner in the on-board messaging app. Certainly not iOS. Maybe BlackBerry OS.

I'm going to ask for further clarification on one point (and edit my answer if you answer it): are you already developing a BlackBerry app to send SMS with the payload, to another blackberry phone, and know it can be parsed as vcard on that platform, and just wonder if this can be achieved outside the blackberry?

Edit - Thinking logically, something critical is missing, or something is added, by the iPhone device. Second point, the BlackBerry code either submits the required thing, or does not include whatever iPhones add that stops detection of vcard.

The solution I'd propose is, get a temporary subscription to an SMS gateway, and send controlled tests, and also capture all the traffic through the gateway if possible.

check out http://www.redoxygen.com/

Tom Pace
  • 2,347
  • 1
  • 24
  • 32
  • My team mate has created a BB app that sends vCard from a BB device to another device. If the other device is any of the smartphone (iPhone, Android or BB) the vCard is received as a simple message. But if the vCard is received by a feature phone or some of the Nokia series (eg. Nokia 6630) it is received as a ready to save vCard. A point I would like to mention is that none of the receiving devices have any external vCard reading applications installed. They use their inbuilt vCard parser (if they have) to detect vCards. Summerizing: BB -> Nokia 6630 (works), iPhone -> Nokia 6630 (fails) – Sahil Khanna Dec 21 '12 at 05:00