【发布时间】:2017-10-19 08:18:15
【问题描述】:
我成功地将Twilio Chat 集成到Android,现在我正在尝试使用Swift 3 将它集成到iOS。
首先要说的:
- 我按照
Embedded libraires和libstdc++中作为框架的说明到链接库并运行脚本来构建阶段 - 我从服务器获得了一个生成且可用的令牌,并从一个已订阅身份的现有频道获得了一个 SID
- 与 Android 的唯一区别是我的
TwilioChatClientProperties只是一个初始化的。
所以这是我的问题:我使用我的令牌生成一个 ChatClient 实例,客户端连接并且我可以检索订阅频道的 SID,但是当我想加入一个接收到的 SID 不成功的频道时,我收到以下错误
error code 1401: Unable to establish connection to Twilio Sync service
我检查了客户端连接但没有同步
这是我的代码:
let props = TwilioChatClientProperties.init()
TwilioChatClient.chatClient(withToken: token, properties: props, delegate: self ){
(result, client) -> Void in
if (result?.isSuccessful())!{ //=> success
for channel in (client?.channelsList().subscribedChannels())!{
if channel.sid == channel_sid{
// found
channel.join(completion: { (resultJoinChannel) in
// never print anything
if(resultJoinChannel?.isSuccessful())!{
print("joined channel")
}else{
print("pb joining channel")
}
})
}
}
}
}
我不知道为什么我可以检索频道但不能加入其中一个!
经过几次努力,我仍然处于同一水平。我想添加一些关于我的日志的信息,这是我尝试同步时的最后一条日志:
2017-05-26 10:52:09.090925+0200 [967:593374] SyncDocument[1]:
0x1aec7cb40 | 05/26/10:52:09.090 | CRITICAL | 38
| SyncDocument | request 5 flowId xxx
error code 1401: Unable to establish connection to Twilio Sync service
2017-05-26 10:52:09.091380+0200 [967:593374] TNRawHttp[2]:
0x1aec7cb40 | 05/26/10:52:09.091 | WARNING | 13
| TNRawHttp | Could not find any requests for this id: xxx
2017-05-26 10:52:09.091609+0200 [967:593374] SyncDocument[1]:
0x1aec7cb40 | 05/26/10:52:09.091 | CRITICAL | 40
| SyncDocument | request 6 flowId xxx
error code 1401: Unable to establish connection to Twilio Sync service
2017-05-26 10:52:09.091887+0200 [967:593374] TNRawHttp[2]:
0x1aec7cb40 | 05/26/10:52:09.091 | WARNING | 13
| TNRawHttp | Could not find any requests for this id: xxx
2017-05-26 10:52:09.092098+0200 [967:593374] SyncDocument[1]:
0x1aec7cb40 | 05/26/10:52:09.092 | CRITICAL | 42
| SyncDocument | request 7 flowId xxx
error code 1401: Unable to establish connection to Twilio Sync service
2017-05-26 10:52:09.092704+0200 [967:593374] TNRawHttp[2]:
0x1aec7cb40 | 05/26/10:52:09.092 | WARNING | 13
| TNRawHttp | Could not find any requests for this id: xxx
2017-05-26 10:52:09.093595+0200 [967:593374] SyncDocument[1]:
0x1aec7cb40 | 05/26/10:52:09.093 | CRITICAL | 44
| SyncDocument | request 8 flowId xxx
error code 1401: Unable to establish connection to Twilio Sync service
2017-05-26 10:52:09.093876+0200 [967:593374] TNRawHttp[2]:
0x1aec7cb40 | 05/26/10:52:09.093 | WARNING | 13
| TNRawHttp | Could not find any requests for this id: xxx
2017-05-26 10:52:09.094077+0200 [967:593374] SyncDocument[1]:
0x1aec7cb40 | 05/26/10:52:09.093 | CRITICAL | 46
| SyncDocument | request 9 flowId xxx
error code 1401: Unable to establish connection to Twilio Sync service
2017-05-26 10:52:09.094368+0200 [967:593374] TNRawHttp[2]:
0x1aec7cb40 | 05/26/10:52:09.094 | WARNING | 13
| TNRawHttp | Could not find any requests for this id: xxx
2017-05-26 10:52:09.106080+0200 [967:593765] TNHttpTwilsockMessageResult[2]:
0x16e5f3000 | 05/26/10:52:09.105 | WARNING | TNHttpTwilsockMessageResult
| Could not deliver http request via twilsock: Twilsock has been stopped
2017-05-26 10:52:09.106325+0200 [967:593765] IPM[1]:
0x16e5f3000 | 05/26/10:52:09.106 | CRITICAL
| IPM | public channel request request failed for CHxxxx
2017-05-26 10:52:09.106867+0200 [967:593765] TNRegNotificationCtxSession[2]:
0x16e5f3000 | 05/26/10:52:09.106 | WARNING | 19 | TNRegNotificationCtxSession
| Could not operate with notification context in twilsock. Error 9
2017-05-26 10:52:09.109605+0200 [967:593766] TNWebsocket[1]:
0x16e67f000 | 05/26/10:52:09.109 | CRITICAL | 4
| TNWebsocket
| Received error while waiting for message: Exception: Bad socket descriptor
2017-05-26 10:52:09.110852+0200 [967:593765] TNFinalState[2]:
0x16e5f3000 | 05/26/10:52:09.110 | WARNING | 49
| TNFinalState | Unexpected event: Error
0x1aec7cb40 | 05/26/10:52:09.111 | INFO
| 35 | SyncMap | destructed
0x1aec7cb40 | 05/26/10:52:09.111 | INFO
| 29 | SyncList | destructed
0x16e5f3000 | 05/26/10:52:09.111 | INFO
| 1 | TNTwilsockClient | onDisconnectedImpl >> Final state
0x16e5f3000 | 05/26/10:52:09.112 | WARNING
| 49 | TNFinalState | Unexpected event: Disconnected
0x16e5f3000 | 05/26/10:52:09.112 | DEBUG
| 1 | TNTwilsockClient | ~TNTwilsockClient - begin
0x16e5f3000 | 05/26/10:52:09.113 | DEBUG
| 1 | TNTwilsockClient | Cleaning observers list - begin
0x16e5f3000 | 05/26/10:52:09.113 | DEBUG
| 1 | TNTwilsockClient | Cleaning observers list - end
0x16e5f3000 | 05/26/10:52:09.114 | DEBUG
| 1 | TNTwilsockClient | ~TNTwilsockClient - end
0x16e2ab000 | 05/26/10:52:09.616 | DEBUG
| 22 | TSSubscriptions | Sending subscription request for action: establish
0x16e2ab000 | 05/26/10:52:09.616 | INFO
| 12 | TNHttpTransportClient | trying to send request to: https://cds.us1.twilio.com/v4/Subscriptions
0x16e2ab000 | 05/26/10:52:09.616 | CRITICAL
| 12 | TNHttpTransportClient | Http transport has been shut down
0x16e2ab000 | 05/26/10:52:09.616 | WARNING
| 22 | TSSubscriptions | Error while persisting subscriptions: establish
0x16e2ab000 | 05/26/10:52:14.055 | DEBUG
| 22 | TSSubscriptions | Sending subscription request for action: establish
0x16e2ab000 | 05/26/10:52:14.055 | INFO
| 12 | TNHttpTransportClient | trying to send request to: https://cds.us1.twilio.com/v4/Subscriptions
0x16e2ab000 | 05/26/10:52:14.055 | CRITICAL
| 12 | TNHttpTransportClient | Http transport has been shut down
0x16e2ab000 | 05/26/10:52:14.056 | WARNING
| 22 | TSSubscriptions | Error while persisting subscriptions: establish
0x16df63000 | 05/26/10:52:20.937 | DEBUG
| 22 | TSSubscriptions | Sending subscription request for action: establish
0x16df63000 | 05/26/10:52:20.937 | INFO
| 12 | TNHttpTransportClient | trying to send request to: https://cds.us1.twilio.com/v4/Subscriptions
0x16df63000 | 05/26/10:52:20.937 | CRITICAL
| 12 | TNHttpTransportClient | Http transport has been shut down
0x16df63000 | 05/26/10:52:20.937 | WARNING
| 22 | TSSubscriptions | Error while persisting subscriptions: establish
0x16df63000 | 05/26/10:52:35.238 | DEBUG
| 22 | TSSubscriptions | Sending subscription request for action: establish
0x16df63000 | 05/26/10:52:35.238 | INFO
| 12 | TNHttpTransportClient | trying to send request to: https://cds.us1.twilio.com/v4/Subscriptions
0x16df63000 | 05/26/10:52:35.239 | CRITICAL
| 12 | TNHttpTransportClient | Http transport has been shut down
0x16df63000 | 05/26/10:52:35.239 | WARNING
| 22 | TSSubscriptions | Error while persisting subscriptions: establish
0x16df63000 | 05/26/10:52:51.354 | DEBUG
| 22 | TSSubscriptions | Sending subscription request for action: establish
0x16df63000 | 05/26/10:52:51.354 | INFO
| 12 | TNHttpTransportClient | trying to send request to: https://cds.us1.twilio.com/v4/Subscriptions
0x16df63000 | 05/26/10:52:51.354 | CRITICAL
| 12 | TNHttpTransportClient | Http transport has been shut down
0x16df63000 | 05/26/10:52:51.354 | WARNING
| 22 | TSSubscriptions | Error while persisting subscriptions: establish
0x16df63000 | 05/26/10:53:25.597 | DEBUG
| 22 | TSSubscriptions | Sending subscription request for action: establish
0x16df63000 | 05/26/10:53:25.598 | INFO
| 12 | TNHttpTransportClient | trying to send request to: https://cds.us1.twilio.com/v4/Subscriptions
0x16df63000 | 05/26/10:53:25.598 | CRITICAL
| 12 | TNHttpTransportClient | Http transport has been shut down
0x16df63000 | 05/26/10:53:25.598 | WARNING
| 22 | TSSubscriptions | Error while persisting subscriptions: establish
0x16df63000 | 05/26/10:54:08.247 | DEBUG
| 22 | TSSubscriptions | Sending subscription request for action: establish
0x16df63000 | 05/26/10:54:08.248 | INFO
| 12 | TNHttpTransportClient | trying to send request to: https://cds.us1.twilio.com/v4/Subscriptions
0x16df63000 | 05/26/10:54:08.248 | CRITICAL
| 12 | TNHttpTransportClient | Http transport has been shut down
0x16df63000 | 05/26/10:54:08.248 | WARNING
| 22 | TSSubscriptions | Error while persisting subscriptions: establish
我也尝试离开频道并在之后重新加入,但仍然无法正常工作。对用户和频道知之甚少却无法执行操作,这很奇怪。
【问题讨论】:
标签: ios swift3 synchronization twilio channel