Connection is not ready error with Travel Sample iOS App

Hello,

We are trying Travel Sample iOS with Couchbase Enterprise Server 5.0 and Gateway 2.0 with example sync gateway file.

We can login to the Sync Gateway and can see all the documents. As well as our Python Web App is working fine. We are able to book flight reservations etc. However when we launch our iOS sample app, it does seem to connect to the sync gateway.

In the iOS App, we have changed following parameter.

var kRemoteSyncUrl = “ws://example.com:4984”

Error from xcode.

startPushAndPullReplicationForCurrentUser()
PushPull Replicator: 0/0, error: nil, activity = connecting
fetchBookingsForCurrentUser(observeChanges:)
2018-05-20 21:49:37.398498-0400 TravelSample[23859:1202242] [] nw_connection_fillout_tcp_statistics 1 Connection is not ready
2018-05-20 21:49:37.399445-0400 TravelSample[23859:1202242] [] tcp_connection_get_statistics Failed to get statistics from connection
PushPull Replicator: 0/0, error: nil, activity = busy
updateUIWithUpdatedBookings(_:error:)

Can you please advise what may be missing here?

Thanks.

From logs, it does not appear that the app was unable to connect to the SGW because the replicator is in the “busy” state
. If the app was unable to connect to the SGW, you should see something along these lines (i.e. replicator should be taken offline eventually because it failed to connect)

Sync ERROR: {Repl#7} Got LiteCore error: Operation timed out (2/60)
PushPull Replicator: 0/0, error: Optional(Error Domain=NSPOSIXErrorDomain Code=60 "Operation timed out" UserInfo={NSLocalizedDescription=Operation timed out}), activity = offline

So what user did you log into the app with ?

Hi Priya,

We have created a user from the Python web app which we tried to login with in the mobile app. For the SGW, we have created an Admin user and using it. We can see all the documents in the SGW admin interface and it seems to work just fine with our java code but iOS seems to have issues. Could it be something that we need to setup on the xcode side?

I tried use a proxy as well to use secure server and converted ws to wss.

var kRemoteSyncUrl = “wss://example.com”

Thanks

What do you mean by “java code” …you own app server or Android app?

There shouldn’t be anything specific that you would have to do for iOS other than changing the two consts (one Sync Gateway endpoint and the other is the travel web app endpoint). As I already pointed out, the issue isn’t with the app unable to connect to the Sync Gateway. So changing proxy settings etc isn’t going to make a difference.

Once you created user, Did you change the Sync Gateway configuration with the right user that you created via the web app?
Check out the instructions here .If you are using credentials other than demo user, you must add that user to the Sync Gateway config file . Please find details here