I am trying to join a group over QUICKBLOX and after compiling my join group code. it's showing me this error.
(Error Domain=com.quickblox.chat Code=-1004 "(null)" UserInfo={NSLocalizedRecoverySuggestion=You have to be connected to Chat in order to use Chat API.})
My code is :-
let groupChatDialog: QBChatDialog = QBChatDialog(dialogID: "57442b84a28f9a759100000e", type: QBChatDialogType.Group)
self.groupChatDialog.joinWithCompletionBlock { (error: NSError?) -> Void in
print(error)
Anybody knows what is the problem here.
Himanshu,
Error description clearly says you will have to login to chat session before joining to any group dialog.
In case if you are not aware, Quickblox makes use of two sessions
Session that you establish with server by using
[QBRequest logInWithUserLogin:"quickblox_user_name" password: "quickblox_password" successBlock:^(QBResponse *response, QBUUser *user) {
} errorBlock:^(QBResponse *response) {
}];
This will only authenticate your user to be valid quickblox user.
Docs clearly says in order to recieve seamless messages/chats you will have to log in to chat session.
Session that will allow you to send and recieve realtime chats and will also allow you to join to group dialogs.
[[QBChat instance] connectWithUser:user completion:^(NSError * _Nullable error) {
}];
Try joining the dialog once the completion block of connectWithUser is triggered. Dialog will join with no issue.