0

I am having trouble with the Twilio iOS chat client. In short, when I try to create a chat client, the process begins but never completes. I make a call to TwilioChatClient.chatClientWithToken:properties:delegate:completion:, and the completion never runs. I provide a delegate for the chat client, and its chatClient:synchronizationStatusUpdated: function gets called once with the status argument set to TCHClientSynchronizationStatusStarted, but that function is never called again.

I don't have this problem when I create a client using the same token (except for the APN or FCM push credential) on Android. I also don't have this problem on iOS or Android in my development environment, which uses a different Twilio account from my staging environment, where I'm seeing this error. One might conclude that I've misconfigured something in my staging environment, but, even if that were the case, I would expect client creation to finish with a failure status, not start and never finish.

Can anyone shed some light on this problem? I'm using version 2.0.0 of the iOS Chat library and version 1.0.0 of the Android library.

1 Answers1

0

I have the same issue.

I built up a parallel project based on Twilio's ChatQuickstart project, also enabling and configuring push notification. The ChatQuickstart project works fine and is using the same Twilio service in the background and the exact same Twilio frameworks.

I set TwilioChatClient.setLogLevel(.debug) in both my main project and ChatQuickstart to compare the output.

This is when they deviated from each other.

<<<<TwilioChatClient: 0x6000003e0600>>>> TNWebsocket[4]:     0x7000042e3000 | 10/10/16:04:48.371 | DEBUG    | 5      | TNWebsocket | Receive message 136 bytes
<<<<TwilioChatClient: 0x6000003e0600>>>> TNTwilsockClient[4]:     0x7000042e3000 | 10/10/16:04:48.372 | DEBUG    | 1      | TNTwilsockClient | onMessageReceived (152)
TWILSOCK V3.0 131
{"method":"reply", "id":"5548856787e7426f90d03466e3df84938493", "payload_size":0, "status":{"code":400,"status":"wrong-ers-response"}}

The .debug trace indicates that the connection status is being updated but my delegate is not being called.

After further investigation we found that the JWT token generated was using an invalid SID for push credentials - in our case 'Dev'. The android SDK had no problem with this but the iOS SDK was in this respect more sensitive.

Facit: Ensure that the SID for the iOS Push Credentials is valid when building the token.

  • The root cause was pretty much the same for me. I was providing no SID to the JWT token builder in my staging environment. Sorry I didn't say something earlier; I probably would've saved you some time. – Christopher Simmons Nov 10 '17 at 00:26