Home > Articles > Home & Office Computing > Mac OS X

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend

Mingling

The section phase of the sync session is actually the easiest for the client to handle. The mingling phase is the point in the session in which the truth database decides what the final truth is. If a piece of data is changed by only one application, it is easy to decide what the final truth is. If multiple applications have made modifications, the truth database might ask the user to decide what the final truth is. During this phase, all the participants of the session are expected to wait until the truth database is finished. However, even here it is possible to tell the session that you will wait for only so long:

BOOL mingleSuccessful;
mingleSuccessful = [sess prepareToPullChangesForEntityNames:filtered 
             beforeDate:[NSDate distantFuture]];
if (!mingleSuccessful) {
 //BAIL!
}

This phase is handled completely by one call to the session: prepareToPullChangesForEntityNames:beforeDate:. Note that I used the filtered array that I built during the last phase to select the entity names. Because the sync engine previously told me to skip certain entities, it is unnecessary to add them into the mingle. In this example, I also set the deadline for the session to be in the far future. In a production application, it might be wiser to wait for a shorter period of time.

  • + Share This
  • 🔖 Save To Your Account