When updating an Address Book record in Cocoa, I read that I had modify the record using ABRecordSetValue(). But it wouldn’t change. Even if I called ABAddressBookSave() afterwards, it just wouldn’t change. It turns out I had to call ABAddressBookAddRecord() also. There is no ABAddressBookUpdateRecord(), but it turns out that the ABAddressBookAddRecord function does the same. I expected that it would give me a duplicate record, but it does not, it updates the existing record. Glad to have that sorted out, I hope this helps you as well.

Share and Enjoy:
  • Print
  • del.icio.us
  • Facebook
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Twitter

  One Response to “Updating an Address Book record”

  1. Hi Nik,
    Thank you for this trick, I thought, I’ll be crazy if i’ve to do a remove/add just for an Update.
    So easy:
    - ABRecordSetValue with the property what was changed
    - ABAddressBookAddRecord
    - ABAddressBookSave

    Thanks again.

 Leave a Reply

(required)

(required)

* Copy this password:

* Type or paste password here:

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

   
© 2012 Niklas Saers' blog Suffusion theme by Sayontan Sinha