如果您想在groupchat中添加用戶,則需要更新組對話。
QBChatDialog *updateDialog = [[QBChatDialog alloc] initWithDialogID:@"53aac645535c12bd3b008a40" type:QBChatDialogTypeGroup];
updateDialog.pushOccupantsIDs = @[@"300", @"301", @"302"];
updateDialog.name = @"school friends";
[QBRequest updateDialog:updateDialog successBlock:^(QBResponse *responce, QBChatDialog *dialog) {
} errorBlock:^(QBResponse *response) {
}];
對於更詳細檢查此Update_group_dialog
以及在集體對話檢查聊天Chat_in_group_dialog
不要忘記使用委託方法。
編譯標誌QBChatDelegate
- (void)chatRoomDidReceiveMessage:(QBChatMessage *)message fromDialogId:(NSString *)dialogId{
}
編輯1: -你會得到DialogId與retriving所有對話。
QBResponsePage *page = [QBResponsePage responsePageWithLimit:100 skip:0];
[QBRequest dialogsForPage:page extendedRequest:nil successBlock:^(QBResponse *response, NSArray *dialogObjects, NSSet *dialogsUsersIDs, QBResponsePage *page) {
} errorBlock:^(QBResponse *response) {
}];
編輯2: -要知道dialogId創造新的對話框使用createChatNotificationForGroupChatCreation方法時。
- (QBChatMessage *)createChatNotificationForGroupChatCreation:(QBDialog *)dialog
{
// create message:
QBChatMessage *inviteMessage = [QBChatMessage message];
NSMutableDictionary *customParams = [NSMutableDictionary new];
customParams[@"xmpp_room_jid"] = dialog.roomJID;
customParams[@"name"] = dialog.name;
customParams[@"_id"] = dialog.ID;
customParams[@"type"] = @(dialog.type);
customParams[@"occupants_ids"] = [dialog.occupantIDs componentsJoinedByString:@","];
// Add notification_type=1 to extra params when you created a group chat
//
customParams[@"notification_type"] = @"1";
inviteMessage.customParameters = customParams;
return inviteMessage;
}
你想對話只爲A和B或像A,B,C,D這樣的組? –
嗨巴達爾,我想它像A,B,C,D可以有很多用戶。所以我想要一個組 –