iTunes fails to sync Contacts

Issue: iTunes failed to update iPad/iPhone with Address Book contacts changed on iMac
Symptoms (at various times):
  • contacts changed on imac didn't update
  • Selected Group in iTunes -> Sync Contacts does not update or remains grey.
Software: iTunes 11.*, IOS 6, iPhone (may occur with other combinations)

Cause: Somehow the internal Address Book database became corrupt.
Identification: This can be seen by opening Console app and looking at the Sync -> syncservices.log. Look through recent history or add an Insert Marker (menu option) and then try to sync. If you see a line that contains 'Error' and a comment about a Record XXXXX where XXXXX is some arbitrary UUID (hex number containing several '-')

Proving the Problem

In my case I had one or two corrupt records. My steps to prove the issue, with iDevice plugging in and iTunes open
1) Backup the address book.
2) Proved the point by deleting all the local contacts (On My Mac) - be careful if you have networked contacts too, ignore them
3) Maybe Optional: unsync/delete all contacts from iPhone. I did this just to ensure a clean starting point.
4) in Address Book (on Mac) create one test group and test contact.
5) The group should pop up within seconds in iTunes under the Contacts group names (if it doesn't try restarting your mac just in case sync services isn't running. There may be ways to start it manually but...)
6) If the previous step works then sync iPhone and check that test contact is synced ok.
7) If ok so far now the next step is finding the broken contacts...

Fixing the Problem

How I did it (not overly efficient):
1) with syncservices.log open (and a marker added), select first half roughly of your (On My Mac) contacts and press delete and confirm. Note make sure you delete them not just remove them from a group.
2) Either sync to iDevice and look for lack of complain OR faster just undelete (fan-Z) and look for issue popping up in log file as record are re-added (this way may not even need iTunes running). If there was no issue repeat for the other half of the file. The error should pop up.
3) Use binary division to narrow the problem down. Note if you have multiple errors you need to track them a little better.

Future Thoughts

There's probably a neat way to turn the UUID into a specific set of cards or other items causing problems. I looked into the Address Book backup files but in my case I didn't find an easy way to identify the broken relationships. I also had a quick look at the database using sqlite3 but didn't spend much time at it. It is probably worth doing this.

Given that the error is in the internal structures it may be that saving all entries as vCards (rather than a Address database archive), then reimporting them all will remove the problem, I didn't think of that at the time and I'm not sure what relationships will be lost (eg groups?).
In the end I had one or two problem records, I simply copied the data, deleted the records and recreated them by hand, maybe exporting/importing would work too.

In researching the problem I also tried:
This actually seemed to make things worse, although in hindsight I think it was just exposing the problem a bit more. I did need to go back into iTunes and re-set all the sync xyz check boxes.

  • + : A leading plus sign indicates that this word must be present in every object returned.
  • - : A leading minus sign indicates that this word must not be present in any row returned.
  • By default (when neither plus nor minus is specified) the word is optional, but the object that contain it will be rated higher.
  • < > : These two operators are used to change a word's contribution to the relevance value that is assigned to a row.
  • ( ) : Parentheses are used to group words into subexpressions.
  • ~ : A leading tilde acts as a negation operator, causing the word's contribution to the object relevance to be negative. It's useful for marking noise words. An object that contains such a word will be rated lower than others, but will not be excluded altogether, as it would be with the - operator.
  • * : An asterisk is the truncation operator. Unlike the other operators, it should be appended to the word, not prepended.
  • " : The phrase, that is enclosed in double quotes ", matches only objects that contain this phrase literally, as it was typed.


Related Sites