iPhone 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 asyncOnlineLogin. 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 asyncOnlineLogin.

Explanation 2: The connection between the device and Unwired Server may be down. You can check the current connection status directly using the SUPMessageClient API:

int connectionStatus = [SUPMessageClient status];
	/*!
	 0: Not started.
	 1: Started,but not connected.
	 2: Started and connected.
	 */

Solution: Use the information to solve the connection problem.