Debugging Sync Clients

Syncrospector is an indispensable developer tool you use to debug your sync client—an application, server, or device that pushes and pulls records to the truth database. The truth database is managed by the sync engine, which is the server in this client-server model. You don’t need to run your client in a debugger or even have the source code available to examine the interaction with the sync engine and the state of the truth database using Syncrospector. Syncrospector is especially useful if your client joins sync sessions when other clients sync. You can even verify whether Apple clients such as MobileMe syncs records as you expect.

Regardless of the Sync Services framework method you choose to sync your client—whether you use the low-level APIs, Core Data sync, or a sync session driver—you need to understand the phases of a sync session to debug your client. Core Data sync and the sync session driver may manage most of the sync session for you but you still need to understand when in the process a client is suppose to push changes, for example, to verify that your client is syncing correctly. You can use Syncrospector to verify whether a client performs these steps correctly:

  1. Registers a custom schema.

  2. Registers its client description.

  3. Syncs as follows:

    1. Negotiates a sync mode.

    2. Pushes changes.

    3. Pulls changes.

    4. Finishes or cancels syncing.

  4. Refresh syncs on request.

  5. Joins sync sessions.

Read Sync Services Overview and Managing Your Sync Session to learn more about the Sync Services client-server architecture and phases of a sync session. If you are using Core Data sync or a sync session driver, you don’t need to know the API details but you should glance at the flow charts in Managing Your Sync Session to better understand the details of the steps above.

The following chapters cover tasks you can perform using Syncrospector during each of the above steps. For example, all clients should verify whether they refresh sync correctly since this is a user-generated request, not a sync mode controlled by your client. You can use Syncrospector to force a refresh sync or any other sync mode you want to test.