iOS Device Cannot Sync

Problem: The device client cannot synchronize with Unwired Server, with errors.

Explanation 1: The Unwired Server may be down. The error would report an NSException that includes name: loginToSync, and reason: No connection to server because the Unwired Server is down or unreachable. The loginToSync method can detect if the server is unreachable (the messaging layer is not in "Connected" state) within a timeout.

Note: Sybase does not recommend using loginToSync, because it blocks while waiting for network response. Instead, use beginOnlineLogin. This call sends the login message to Unwired Server and returns immediately. The application is then responsible for detecting login success or failure using the callback handler.

Solution: Report that Unwired server is down, or wait for it to come back online. Alternatively, redesign using beginOnlineLogin.

Explanation 2: The connection between the device and Unwired Server may be down. You can test to make sure the device is connected as required using the SUPMessageClient API:

    while([SUPMessageClient status] != STATUS_START_CONNECTED)
        [NSThread sleepForTimeInterval:0.2];
        [SampleApp_SampleAppDB beginOnlineLogin:@"supUser" password:@"s3pUser"];
        while([SampleApp_SampleAppDB getOnlineLoginStatus].status == SUPLoginPending)
    {
        [NSThread sleepForTimeInterval:0.2];
    }
// After this, the status will be either SUPLoginSuccess or SUPLoginFailure
if([SampleApp_SampleAppDB getOnlineLoginStatus].status == SUPLoginSuccess)
    [SampleApp_SampleAppDB subscribe];

Solution: This reports the connection status. With a connection established, run this code on the device. After you run the code on the device, you can check from Sybase Control Center to see if the device is online.