Best way to check for conflicts on sync

51 views
Skip to first unread message

Todd Freese

unread,
Mar 13, 2014, 1:47:36 PM3/13/14
to mobile-c...@googlegroups.com
What is the recommended way of checking for conflicts after a continuous sync?

Do I tie into my KVO progress method and check when the sync finishes?

Or is there a KVO property to observe for conflicts during a sync?

Todd

Jens Alfke

unread,
Mar 13, 2014, 2:27:08 PM3/13/14
to mobile-c...@googlegroups.com

On Mar 13, 2014, at 10:47 AM, Todd Freese <to...@filmworkers.com> wrote:

What is the recommended way of checking for conflicts after a continuous sync?

The best approach is probably to wait till the pull replication finishes or goes idle, check whether it pulled a nonzero number of docs, and then run an all-docs query with its allDocsMode set to kCBLOnlyConflicts.

Another approach is to observe the kCBLDatabaseChangeNotification using NSNotificationCenter. The userInfo of the notification contains an array of CBLDatabaseChange objects. Each of those has an .inConflict property that indicates whether the doc is now in conflict.

—Jens
Reply all
Reply to author
Forward
0 new messages