Problem: The device client cannot synchronize with SAP Mobile Server, with errors.
Explanation 1: The SAP Mobile Server may be down. The error would report an NSException that includes name: loginToSync, and reason: No connection to server because the SAP Mobile 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.
Solution: Report that SAP Mobile Server is down, or wait for it to come back online. Alternatively, redesign using beginOnlineLogin.
Explanation 2: The connection between the device and SAP Mobile Server may be down. You can test to make sure the device is connected as required using the SUPApplication API:
// make sure connection established while ([SUPApplication connectionStatus] != SUPConnectionStatus_CONNECTED) { NSLog(@"waiting to connect..."); sleep(2); } NSLog(@"connection established"); while ([SUPApplication registrationStatus] != SUPRegistrationStatus_REGISTERED) { NSLog(@"waiting to register..."); sleep(2); } NSLog(@"registration completed"); [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 SAP Control Center to see if the device is online.