1

1 to 1 chat is working but group chat is not working.

Created a group dialogue:

let chatDialog = QBChatDialog(dialogID: nil, type: QBChatDialogType.group)
let currentUserId  = UserDefaults.standard.integer(forKey: "CurrentUserID")
let groupName = "\(groupUsers[0].fullName ?? "" ), \(groupUsers[1].fullName ?? "" )..."
chatDialog.name = groupName
var ids = groupUsers.map { (user2) -> UInt in
    return user2.id
}
chatDialog.occupantIDs = ids as [NSNumber]
QBRequest.createDialog(chatDialog, successBlock: { (response: QBResponse?, createdDialog : QBChatDialog?) -> Void in
    print(response ?? "", createdDialog ?? "")
    print("dialog created")
    self.dialogUpdateBlock!()
    SVProgressHUD.dismiss()
    self.navigationController?.popViewController(animated: true)
}) { (responce : QBResponse!) -> Void in
    print(responce, "error")
    SVProgressHUD.dismiss()
}

But when I send the chat message it does not received live for any occupants in either of these methods.

func chatDidReceive(_ message: QBChatMessage) {
    print(message) //This is working in one-to-one chat but not working in group chat.
}

func chatRoomDidReceive(_ message: QBChatMessage, fromDialogID dialogID: String) {
    print(message)
}
rmaddy
  • 314,917
  • 42
  • 532
  • 579

0 Answers0