I am trying to find a way to amend an Address Book record which will work the same on all OSs (post 3.0, anyway) and correctly sync with Google Contacts/Outlook.
I tried writing the new email data to the existing record and writing it back out. This worked fine for several days when testing on iOS4, and I thought I was home and dry, but I found that on iOS 3.1.3 the ABAddressBookSave call throws a SQLite database error, complaining about trying to create duplicate entries:
CPSqliteStatementPerform: constraint failed for INSERT INTO ABPerson (ROWID, First, Last, Middle, Organization, Kind, Nickname, Prefix, Suffix, FirstSort, LastSort, CreationDate, ModificationDate, CompositeNameFallback, StoreID, FirstSortSection, LastSortSection, FirstSortLanguageIndex, LastSortLanguageIndex) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); CPSqliteStatementReset: PRIMARY KEY must be unique
When I tried deleting the old entry and replacing it with an entirely new one instead, it caused duplicate email address entries (I am guessing this is because the sync process saw it as a new record and tried to merge them, maybe when synching with Google)
The Apple docs ("Address Book Programming Guide for iPhone") gives examples for creating and deleting entries, but not for partial updating.
Any ideas? All suggestions gratefully received
Cheers
Peter Johnson
Soluble Apps (www.solubleapps.com)