MY GOAL is to allow the users to create a contact using the standard UI (ABPersonViewController) but give them the choice to add it to the addressbook or to store it locally (in my CoreData db). As such, I need to do one of the following:
- Store a copy of an ABRecord as NSData in my own DB and always work on that copy.
- Store a representation of an ABRecord (vCard, proprietary format, other...) and convert to/from that representation whenever the user wants to edit a contact (so as to provide an ABRecord to the ABPersonViewController).
MY PROBLEM is that I cannot figure out a way to create records without adding them to the user's address book.
SOME CONTEXT
In the Address Book Programming Guide for iOS (link here), Apple's documentation states:
Even though records are usually part of the Address Book database, they can also exist outside of it. This makes them a useful way to store contact information your application is working with.
Which, of course, sounds perfect for what I need to do. But it does not give any instructions about ways to create ABRecords outside of an Addressbook.
The API only seems to provide ways to create then in a specified source (ABPersonCreateInSource) or in the default source (ABPersonCreate). On top of that, although the documentation says to call ABAddressBookAddRecord to add the created record to the addressbook, my tests show that the record is added anyways ! (Maybe it's added by the ABPersonViewController, I haven't checked).
I have searched a lot on internet and, although a few people have asked similar questions, nobody seems to have answered in a way that actually works ;-)
But I've seen several apps do this so I'm confident that it's possible.
MY QUESTION: How would you do this ?