Nonblocking Synchronization

An example that illustrates the basic code requirements for connecting to Unwired Server, updating mobile business object (MBO) data, and synchronizing the device application from a device application based on the Client Object API.

Subscribe to the package using synchronization APIs in the generated database class, specify the groups to be synchronized, and invoke the asynchronous synchronization method (beginSynchronize).

  1. If you have not yet synchronized with Unwired Server, perform a synchronization.
  2. Set the synchronization parameters if there are any.
  3. Make a blocking synchronize call to Unwired Server to pull in all MBO data:
    [SUP101SUP101DB synchronize]; 
  4. List all customer MBO instances from the local database using an object query, such as findAll, which is a predefined object query.
    SUPObjectList *objlist = [SUP101Customer findAll]; 
  5. Find and update a particular MBO instance, and save it to the local database.
    SUP101Customer *customer = [SUP101Customer findByPrimaryKey:32838];
    //Change some sttribute of the customer record
    customer.fname= @"New Name";
    [customer save];
  6. Submit the pending changes. The changes are ready for upload, but have not yet been uploaded to the Unwired Server.
    [Customer submitPending];
  7. Use non-blocking synchronize call to upload the pending changes to the Unwired Server. The previous replay results and new changes are downloaded to the client device in the download phase of the synchronization session.
    [SUP101SUP101DB beginSynchronize];