【发布时间】:2019-06-02 14:32:57
【问题描述】:
我正在尝试将 Twilio Chat 添加到我的 React Native 项目中。我收到名称 SyncError 和代码 0 的错误。我只是想确认它此时已连接。这是我的基本设置。
在顶部导入
import {Client as Chat} from 'twilio-chat'
在我的课堂上
componentDidMount = async () => {
console.log(Chat);
const token = await AsyncStorage.getItem('auth-token');
axios.get(config.apiUrl + '/chat/details', { headers: { Authorization: token } })
.then(res => {
console.log(res);
Chat.create(res.data.twilioToken)
.then(client => {
console.log('client', client);
this.subscribeToAllChatClientEvents(client);
})
.catch(error => {
console.log('There was an error', error);
});
})
.catch(err => {
console.log(err);
})
}
该错误还提到了“未处理的承诺拒绝”,但我在需要的地方包含了任何 catch 块。
感谢您的帮助。
【问题讨论】:
-
在什么时候抛出这些错误?
标签: react-native twilio twilio-programmable-chat