Mapping ABPerson to Sync Services

  • Hi,

    I'm trying to implement a customer database in my application. I'm
    storing them in my own CoreData-database, but the address book
    contains a superset of the list (so I don't have to implement an
    address/telephone number/etc editor).
    When the application determines that the address book entry no longer
    exists, it should pull its own version to the address book database.
    This might happen when the user deletes the entry or migrates the
    database to another computer.

    Additionally, due to some reasons outside the scope of this email,
    there might be multiple customer databases on the same machine with
    potentially different versions of the same entry (Time Machine might
    cause this, when two different versions of different databases
    containing the same record are restored), which can cause merge
    conflicts when trying to re-add the record from multiple differing
    copies.
    This sounds like a perfect application for the Sync Services
    (implementing a filter that only syncs records that exist in the
    customer databases). However, in order to import an address book
    record into my customer database, I have to get a full list of all
    entries and let the user choose one (presenting some information
    about each entry). The ABPeoplePickerView would be perfect for this.
    Now I discovered a problem with this plan: For this to work, I have
    to somehow match the address book entries I get from the Sync
    Services to the ABRecords I get from the ABPeoplePickerView. How can
    I do this? Both have a unique identifier, but from my tests, they are
    not the same, and both records only contain one of them. I could do a
    match based on name, phone number, etc, but this would be an ugly
    hack, and would break when there are two address book entries with
    the same data (happened a few times here due to some issues with my
    Phone and iSync). Does anybody have an idea?

    thanks
    andy
  • On Oct 2, 2007, at 7:28 PM, Andreas Monitzer wrote:

    > The ABPeoplePickerView would be perfect for this.
    > Now I discovered a problem with this plan: For this to work, I have
    > to somehow match the address book entries I get from the Sync
    > Services to the ABRecords I get from the ABPeoplePickerView. How
    > can I do this?

    The only ways to do this are to either directly read the Sync
    Services database using sqlite, or using private methods in the
    SyncServices framework. Unfortunately there is no supported way of
    mapping one client's records to another. I believe Syncrospector does
    this using private methods.

    Nick Zitzmann
    <http://www.chronosnet.com/>
  • > This sounds like a perfect application for the Sync Services
    > (implementing a filter that only syncs records that exist in the
    > customer databases). However, in order to import an address book
    > record into my customer database, I have to get a full list of all
    > entries and let the user choose one (presenting some information
    > about each entry). The ABPeoplePickerView would be perfect for this.

    Why not just sync all of the entries into your app and present a
    picker that way? Then, after they’re picked, filter out the ones you
    don’t want.

    -Ben
  • On Oct 03, 2007, at 19:27, Benjamin Stiglitz wrote:

    > Why not just sync all of the entries into your app and present a
    > picker that way? Then, after they’re picked, filter out the ones
    > you don’t want.

    That's what I'm considering right now, but this would mean that I'd
    have to re-invent the people picker view, which would add a lot of
    unnecessary work.
    Additionally, I wouldn't be able to open a specific contact in the
    address book application for the user (that's required, since
    otherwise the user can't view the details or edit them).

    andy
previous month october 2007 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today