0

我正在尝试使用 QuickBlox 实现私人 1 对 1 聊天,但遵循 Quickblox 文档仅显示http://quickblox.com/developers/Chat#Create_dialog中的群聊。当我尝试仅发送单个 occupants_ids 时,会出现以下错误:

{
"errors": [
"Occupants_ids cannot be less than one."
]
}

我正在使用以下正文创建对话框 API:

{
"type": 3,
"name": "",
"occupant_id": "13822296"
}

我需要更新我的请求正文中的一些键吗?

4

3 回答 3

0

请检查:创建新的 1-1(私人)聊天对话框

文档中的代码对我有用:

let chatDialog: QBChatDialog = QBChatDialog(dialogID: nil, type: QBChatDialogType.Private)
chatDialog.occupantIDs = [user.ID]

QBRequest.createDialog(chatDialog, successBlock: {(response: QBResponse?, createdDialog: QBChatDialog?) in completion?(response: response, createdDialog: chatDialog)

    print("sucess + \(response)")

}, errorBlock: {(response: QBResponse!) in

    print("response + \(response)")
})
于 2016-06-30T05:46:24.627 回答
0
QBChatDialog *chatDialog = [[QBChatDialog alloc] initWithDialogID:null type:QBChatDialogTypePrivate];
chatDialog.occupantIDs = @[@(1530190)];

[QBRequest createDialog:chatDialog successBlock:^(QBResponse *response, QBChatDialog *createdDialog) {

} errorBlock:^(QBResponse *response) {

}];

您可以使用它,并且您应该提供一个 occupantIds。如果它有效,请告诉我。

于 2016-07-04T10:02:08.503 回答
0
 let user = QBUUser()
        user.id = UInt(arrDoctors[sender.tag].QuickBloxId)!
        user.fullName = arrDoctors[sender.tag].title.capitalizeFirst
        ServicesManager.instance().chatService.createPrivateChatDialog(withOpponent: user) { (response, dialog) in
            let chatvc = CHAT_STORYBOARD.instantiateViewController(withIdentifier: "ChatViewController") as! ChatViewController
            chatvc.dialog = dialog
            self.navigationController?.pushViewController(chatvc, animated: true)
        }
于 2018-05-29T12:11:39.997 回答