Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Correct vCard format for iOS devices?

In iOS 5 and above, Apple introduced the ABPersonCreatePeopleInSourceWithVCardRepresentation method, which is pretty useful in feeding a vCard to the Address Book and getting back the ABRecordRefs for the persons created.

However, the Apple vCard seems to be (at least a bit) different from a standard vCard, as I have found out while trying to add standard vCards to the Address Book. Is there a page somewhere detailing what the Apple-format for a vCard should be?

Thanks!

like image 203
Alex Avatar asked Dec 17 '12 11:12

Alex


People also ask

What is vCard for iOS?

You can import or export a virtual card, called a vCard. vCards contain contact information for one or more contacts.

Does VCF work on iOS?

The VCF file is supported by all popular operating systems in the world, including iOS, Android, Windows, Mac. vCard contacts can be shared via email, cloud storage, websites and more. If you have vCard contacts on your computer, you can also choose to import them to your iPhone.


1 Answers

The ABPersonCreatePeopleInSourceWithVCardRepresentation docs state that vCard version 3 is the supported protocol. Unfortunately if you're having troubles with a standard vCard I'm not sure how to help - I did a fair bit of searching (that bounty is good motivation :P) and wasn't able to find any further information.

I don't have my iPhone on me to test, but this guy claims to have successfully imported the following, v2.1 vCard on an iPhone 4 using a QR scanner app (which might be using the API in question). The 3.0 spec is a superset of the 2.1 spec - can you try this vCard and let me know if it works?

BEGIN:VCARD
VERSION:2.1
N:;Company Name
FN:Company Name
ORG:Company Name
TEL;WORK;VOICE;PREF:+16045551212
TEL;WORK;FAX:+16045551213
ADR;WORK;POSTAL;PARCEL;DOM;PREF:;;123 main street;vancouver;bc;v0v0v0;canada
EMAIL;INTERNET;PREF:[email protected]
URL;WORK;PREF:http://www.example.com/
NOTE:http://www.example.com/
CATEGORIES:BUSINESS,WORK
UID:A64440FC-6545-11E0-B7A1-3214E0D72085
REV:20110412165200
END:VCARD

You can read the official 3.0 spec here and here.

As a last ditch solution, there are plenty of vCard parsers out there - it's a dead simple protocol. You could just take any of these (or write one yourself) and manually add the contact to the Address Book using ABPersonCreatePeopleInSourceWithVCardRepresentation.

like image 132
aaronsnoswell Avatar answered Sep 20 '22 00:09

aaronsnoswell