2016-02-26 24 views

回答

0

请检查Quickchat的正式文件。

SimpleSample-chat_users-ios

他们有提到他们的文档中的所有细节。

而且,只需下载演示,并尝试实施。

Group_chat

之前实现群聊不要忘记阅读典型的设置部分。

典型设置[群聊中的功能]

认证:通过聊天记录:你不妨保持 这是很容易通过QuickBlox支持 所有公共讨论的历史档案。一些平台也将要求您实现虐待 并都通过API和 管理面板也支持温和的机制。文件附件:通常附件不支持 1:1/IM聊天:在许多应用中,你可能希望允许用户开始 与其他用户邀请好友的私人通信:QuickBlox支持 邀请好友或添加其他用户,您可能在使用收藏夹 您的应用程序 - 另请参见[聊天:交友/最喜爱的用户列表]

开始创建对话的群聊。

Create_new_group_chat_dialog

QBChatDialog * chatDialog = [[QBChatDialog的alloc] initWithDialogID:空型:QBChatDialogTypeGroup]; chatDialog.name = @“与Bob,Sam,Garry聊天”; //根据需要设置 chatDialog.occupantIDs = @ [@(55),@(678),@(22)];

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

} errorBlock:^(QBResponse *response) { 

}]; 

第二步 - >创建chatnotification

- (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; 
} 

... 

for (NSString *occupantID in dialog.occupantIDs) { 

    QBChatMessage *inviteMessage = [self createChatNotificationForGroupChatCreation:dialog]; 

    NSTimeInterval timestamp = (unsigned long)[[NSDate date] timeIntervalSince1970]; 
    customParams[@"date_sent"] = @(timestamp); 

    // send notification 
    // 
    inviteMessage.recipientID = [occupantID integerValue]; 

    [[QBChat instance] sendSystemMessage:inviteMessage completion:^(NSError * _Nullable error) { 

    }]; 
} 

您将在此委托接收的对手。与abolve链接

- (void)chatDidReceiveSystemMessage:(QBChatMessage *)message 
{ 
} 

可以实现所需的功能群聊。 赞,获取在线用户离开群聊对话框,附件组。等等。

+0

感谢您的答复哥们,但您能否帮我解答一下如何将自定义参数添加到群聊对话框中并通过该自定义参数搜索特定群组。请注意,我想为群聊对话框添加自定义参数,而不是添加到用户或消息。 – user4221623

+0

你检查过了吗?http://quickblox.com/developers/Chat#Custom_parameters –