我正在关注本文Freshchat React Native SDK Integration Steps,这是我的代码(Chat.js):
#导入新鲜聊天区
import { Freshchat, FreshchatConfig } from 'react-native-freshchat-sdk';
import { FreshchatUser } from 'react-native-freshchat-sdk';
#SDK的初始化
var freshchatConfig = new FreshchatConfig('MY_APP_ID', 'MY_APP_KEY');
freshchatConfig.domain = "MY-DOMAIN";
Freshchat.init(freshchatConfig);
#用户信息
var freshchatUser = new FreshchatUser();
Freshchat.setUser(freshchatUser, (error) => {
console.log(error);
});
#尝试发起对话
<View>
<Button
title="start chat"
onPress={() => Freshchat.showConversations()}
/>
</View>
这时我的应用程序意外关闭。我需要重新打开它,但是看不到任何对话或Freshchat屏幕。您能帮我解决这个问题或任何参考或建议吗?
谢谢。
快乐编码:)
更新:Android和iOS均使用上述代码。