Make changes to the application to allow it to initialize as required in 2.1 ESD #3.
[SUP101SUP101DB beginOnlineLogin:supuser password:suppass];
In an MBS application, subscribe caused data to be pushed to the client from the server. In your RBS application, you must invoke synchronize (synchronous replay) or beginSynchronize (asynchronous replay).
An RBS application can synchronize through either a synchronous or asynchronous process. By default, asynchronous replay is enabled. When asynchronous replay is enabled, the server returns after processing the operation replay records that are uploaded to the server in the synchronization session When asynchronous replay is disabled, the server returns after processing the operation replay records that are uploaded to the server, then downloads the results of those operation replay records to the device.
SUPConnectionProfile *sp = [SUPSampleSUPSampleDB getSynchronizationProfile]; [sp setUser:@"supAdmin"]; [sp setPassword:@"supPwd"];
[sp setServerName:@"relayservername.com"]; [sp setNetworkProtocol:@"networkProtocol"]; [sp setPortNumber:portNumber]; [sp setNetworkStreamParams:@"trusted_certificates=certificateName.com;compression=zlib;url_suffix=farmIDForRBS"];
For synchronous synchronization:
[sp setAsyncReplay:NO]; @try { [SUP101SUP101DB synchronize]; } @catch (NSException *exception) { MBOLogError(@"%@: %@", [exception name], [exception reason]); }
If the AsyncReplay flag is turned off, the client object API calls the onSynchronize callback method with an SUPSynchronizationStatus_ FINISHING status after the synchronize.
For asynchronous synchronization:
[sp setAsyncReplay:YES]; @try { [SUP101SUP101DB synchronize]; // or using beginSynchronize to create a background synchronization request. // SUP101SUP101DB beginSynchronize]; } @catch (NSException *exception) { MBOLogError(@"%@: %@", [exception name], [exception reason]); }
If the AsyncReplay flag is turned on, the client object API calls the onSynchronize callback method with an SUPSynchronizationStatus_ASYNC_REPLAY_UPLOADED status after the synchronize, followed by an SUPSynchronizationStatus_FINISHING status.
- (SUPSynchronizationActionType)onSynchronize:(SUPObjectList*)syncGroupList withContext:(SUPSynchronizationContext *)context
The above code examples synchronize the default group. Alternatively, you can synchronize based on the synchronization group the MBO belongs to. Replace the code [MBO getSynchronizationGroup] in your application with:
NSString *mbo_sg = [mbo metaData].synchronizationGroup; [db synchronize:mbo_sg];
The following methods in the registered callback handlers of the database class are called when the replay results are received and processed by the client framework.
When you disable AsyncReplay in the synchronization profile, the database class synchronize is a blocked call. When the method returns, the server data has been synchronized in the database. You no longer need to include a wait period in the code.
Remove this code from your application:
while ([SUP101SUP101DB hasPendingOperations]) { [NSThread sleepForTimeInterval:1]; }