Closed abdulR712 closed 4 years ago
Hello @abdulR712 ,
Can you please share the crash log. It will be helpful for us to debug it. Also, can you please let us know if you are running a release build or a debug build?
@mayur-bhandari i got exactly same issue. Recently it was working fine till yesterday or day before yesterday. Now I see in error console
JSON value '306' of type NSNumber cannot be converted to NSString Error: { message = "Entries must be arrays of the form [key: string, value: string], got: (\n all\n)"; }
the I assure fetchPrevious for all conversations or specific one
hello @mayur-bhandari
I got this one working. I just added a catch for the fetchPrevious method call. But I am facing another issue with the calling functionality.
Currently I am using "@cometchat-pro/react-native-chat": "^2.1.0-beta2" with expo and I am following the sample code provided in the documentation.
In that I am getting an error saying "cannot read property 'getCallEventListener' of undefined" on accepting an audio call.
When I debugged it I am getting undefined for the callSettings variable.
var callSettings = new CometChat.CallSettingsBuilder() .setSessionID(sessionId) .setCallEventListener(callListener) .setIsAudioOnlyCall(audioOnly) .build();
Can you please help me out in this.
Thanks.
Hello @abdulR712,
Can you please share the full code snippet you are using? Also, please let us know if you are using direct or indirect calling flow.
Hello @mayur-bhandari
I am following the sample react project available in the documentation and following is the MainCallScreen Component's Code where i am facing the issue.
`import React, {Component} from 'react'; import { View } from 'react-native'; import {CometChat} from '@cometchat-pro/react-native-chat'; export class MainCallScreen extends Component { constructor(props){ super(props); let callListener = new CometChat.OngoingCallListener({ onUserJoined: user => { console.log('TEST => OngoingCallListener: User joined call:', user); }, onUserLeft: user => { console.log('TEST => OngoingCallListener: User left call:', user); }, onCallEnded: call => { console.log('TEST => OngoingCallListener: Call ended listener', call); this.gotoChat(); }, }); this.addCallListner(); let info = this.props.location.state; console.log("mainCal screen ==>", this.props.location.state) this.sessionId = info.sessionId ? info.sessionId : 'sessionid'; this.defaultLayout = info.enableDefaultLayout; this.entity = info.entityType ? info.entityType : {}; this.entityType = info.entityType ? info.entityType : 'default'; this.acceptedFrom = info.acceptedFrom ? info.acceptedFrom : ''; console.log("sessionId ===>", this.sessionId, callListener); this.callsettings = new CometChat.CallSettingsBuilder().setSessionID(this.sessionId).setCallEventListener(callListener).setIsAudioOnlyCall(true).build(); console.log(this.callSettings); }
addCallListner(){
var listnerID = 'MAIN_CALLING_SCREEN_CALL_LISTENER';
CometChat.addCallListener(
listnerID,
new CometChat.CallListener({
onIncomingCallReceived(call) {
var sessionID = call.getSessionId();
var status = CometChat.CALL_STATUS.BUSY;
CometChat.rejectCall(sessionID, status).then(
rejectedCall => {
console.log('Incoming Call rejected', rejectedCall);
},
error => {
console.log('Call rejection failed with error:', error);
}
);
},
})
);
}
componentDidMount () {
}
componentWillUnmount(){
CometChat.removeCallListener('MAIN_CALLING_SCREEN_CALL_LISTENER');
}
gotoChat(){
if(this.acceptedFrom === 'Home'){
this.props.history.push('/home');
}else{
if(this.entityType === 'user'){
this.props.history.push('/chat', {
uid: this.entity.uid,
username: this.entity.name,
status: this.entity.status,
avatar: this.entity.avatar ? this.entity.avatar : 'user',
});
}
}
}
render(){
return(
<View style={{height: '100%', width: '100%', position: 'relative'}}>
<CometChat.CallingComponent callsettings= {this.callSettings} />
</View>
);
}
}`
I am using the indirect call method.
Please help me out to fix it.
Thanks
Hello @abdulR712,
Please change this.callsettings
to this.callSettings
. You are passing this.callSettings
as prop to the <CometChat.CallingComponent/>
but it is undefined.
Hi @mayur-bhandari,
oh sry thats my mistake. I have corrected it and tried again but I am getting an issue in <CometChat.CallingComponent/>
. I have attached the screenshot of it.
Please let me know is there any dependency which I am missing to include.
Sorry for bothering again.
Thanks.
Hello @abdulR712,
You need to add a Gradle dependency as stated in the documentation here.
Hello @mayur-bhandari,
I am trying it on a simulator for the moment. Do I need to include any dependency for it.
Hello @abdulR712,
The Calling Component uses native Modules and for that, you need to add a dependency as stated in the documentation inside your build.gradle file. If you are using the expo project, you need to eject the expo project into bare workflow to be able to use native dependencies. Since expo does not allow you to use custom native dependencies. You can follow the expo documentation on how to eject your expo project into a bare workflow project. Expo Documentation
Closing due to inactivity. Please reopen if you are having trouble after following the steps mentioned above to run the calling component in an expo project. If you are facing issues while fetching messages, please check this issue.
Hi there,
I have started using CometChat Pro React Sdk and I am facing an issue on retrieving the messages. `let messagesRequest = new CometChat.MessagesRequestBuilder() .setLimit(30) .setUID('abdul') .build();
messagesRequest.fetchPrevious().then( messages => { console.log("Messages for thread fetched successfully", messages); }, error => { console.log("Message fetching failed with error:", error); } );`
I am using the above code to retrieve the messages between the users superhero1 and abdul. When I received the response then the app automatically closes up in the simulator.
But when there is no messages between the users app runs as expected.
And Even when I tried to get the conversation between these two users and then I am able to retrieve the last message.
So I am facing this issue only when there are messages available between the users.
I am using the following versions :
"@cometchat-pro/react-native-chat": "^2.0.12" "react": "16.9.0" "react-native": "0.61.3"
Please help me out
Thanks.