在与 Quickblox 的私人聊天中创建对话问题

Creating Dialog issue in private Chat with Quickblox

我正在尝试与 QuickBlox 实现私人一对一聊天,但遵循 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"
}

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

请检查:Create new 1-1(private) chat dialog

来自 documentaton 的代码对我有用:

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)")
})
QBChatDialog *chatDialog = [[QBChatDialog alloc] initWithDialogID:null type:QBChatDialogTypePrivate];
chatDialog.occupantIDs = @[@(1530190)];

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

} errorBlock:^(QBResponse *response) {

}];

你可以使用这个,你应该提供一个 occupantIds。如果有效请告诉我。

 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)
        }