I've integrated quickblox in my app. as I fetched all user in tableview using this code
QBGeneralResponsePage *page = [QBGeneralResponsePage responsePageWithCurrentPage:1 perPage:100];
[QBRequest usersForPage:page successBlock:^(QBResponse *response, QBGeneralResponsePage *pageInformation, NSArray *users)
{
[_NameArray addObjectsFromArray:users];
}
errorBlock:^(QBResponse *response)
{
}];
}
errorBlock:^(QBResponse *response)
{
NSLog(@"error: %@", response.error);
}];
in _nameArray I've all user information in QBUUSER object form
QBUUser *obj = [Array objectAtIndex:indexPath.row];
NSString *name = obj.fullname;
in retrieve all user. now when loginUser click on particular contact or retrieve user then i create private group one to one communication using this code
-(void)chat
{
chatDialog = [[QBChatDialog alloc] initWithDialogID:NULL type:QBChatDialogTypePrivate];
chatDialog.occupantIDs = @[@(chatuserobj.ID)];
[QBRequest createDialog:chatDialog successBlock:^(QBResponse *response, QBChatDialog *createdDialog) {
} errorBlock:^(QBResponse *response) {
}];
}
and main thing send and receive message in that view controller i have taken textfield for sending message and table view for show message for sending message i have used this code
-(void)startChat
{
[[QBChat instance] addDelegate:self];
QBChatMessage *message = [QBChatMessage message];
[message setText:@"Hey there"];
NSMutableDictionary *params = [NSMutableDictionary dictionary];
params[@"save_to_history"] = @YES;
[message setCustomParameters:params];
[chatDialog sendMessage:message completionBlock:^(NSError * _Nullable error)
{
NSLog(@"Message sent");
}];
}
and used below delegate method
- (void)chatDidReceiveMessage:(QBChatMessage *)message
I actually see the private group in admin panel of quickblox but don't see the sent message. please help me.