Replay Results

The client application can call the hasPendingOperations method after a submitpending call to the server to wait for replay results. This method returns true if there are replay pending requests, otherwise, it returns false.

+(void)hasPendingOperations
while ([SampleApp_SampleAppDB hasPendingOperations])
   	[NSThread sleepForTimeInterval:0.2];

The preceding code example waits indefinitely if the client application does not receive a replay result from the Unwired Server, and if a record has the replayPending flag set. To exit this loop after a particular time interval has passed, you can add a timer.

BOOL shouldWait = YES;
  long sleepTime = 1;
  long timeout = 10*60;
  while (shouldWait && (sleepTime < timeout))
  {
    shouldWait = [SampleApp_SampleAppDB hasPendingOperations];
    if (shouldWait)
    {
      [NSThread sleepForTimeInterval:0.2];
    }
    if (sleepTime <= timeout)
    {
    timeout = timeout - sleepTime;
    }
  }        
  if (shouldWait) {
    MBOLogError(@"Cannot wait , Timeout");
  }