Andrei Andrei - 1 year ago 91
iOS Question

Correct vCard format for iOS devices?

In iOS 5 and above, Apple introduced the

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?


Answer Source

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?

N:;Company Name
FN:Company Name
ORG:Company Name
ADR;WORK;POSTAL;PARCEL;DOM;PREF:;;123 main street;vancouver;bc;v0v0v0;canada

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.