I have integerated QuickBlox iOS sdk v2.5. I am sending messages to a particular and they are being sent to server but for receiving a message - (void)chatDidReceiveMessage:(QBChatMessage *)message is not getting called
This is what I am doing to connect
[[QBChat instance] addDelegate:self];
QBUser *chatUser=[QBUser new];
chatUser.ID=[[[NSUserDefaults standardUserDefaults] objectForKey:USERID] integerValue];
chatUser.password=[[NSUserDefaults standardUserDefaults] objectForKey:PASSWORD];
[[QBChat instance] connectWithUser:chatUser completion:nil];
For creating a chatDialog
QBChatDialog *chatDialog=[[QBChatDialog alloc] initWithDialogID:NULL type:QBChatDialogTypePrivate];
chatDialog.name = @"Chat with Garry";
NSMutableArray *chatPartners=[[NSMutableArray alloc] initWithObjects:[chatPartner objectForKey:@"id"] ,[[NSUserDefaults standardUserDefaults] objectForKey:USERID], nil];
chatDialog.occupantIDs=chatPartners;
[QBRequest createDialog:chatDialog successBlock:^(QBResponse *response, QBChatDialog *createdDialog) {
//Success
NSDictionary* json = [NSJSONSerialization JSONObjectWithData:response.data options:kNilOptions error:nil];
[[NSUserDefaults standardUserDefaults] setObject:[json object
} errorBlock:^(QBResponse *response) {
//error
}];
Then to send message
QBChatMessage *message =[QBChatMessage message];
[message setText:self.messageText.text];
params[@"messageStatus"]=@"Test Message";
params[@"save_to_history"] = @YES;
[message setCustomParameters:params];
[message setRecipientID:[[[NSUserDefaults standardUserDefaults] objectForKey:PARTNERID] integerValue]]; //
[QBRequest createMessage:message successBlock:^(QBResponse *response, QBChatMessage *createdMessage) {
self.messageText.text = @"Type Here...";
[self addMessagetoChat:createdMessage];
NSLog(@"success: %@", createdMessage);
} errorBlock:^(QBResponse *response) {
self.messageText.text = @"Type Here...";
NSLog(@"ERROR: %@", response.error);
}];
Message is sent to the chat but the other user is not able to receive it.- (void)chatDidReceiveMessage:(QBChatMessage *)message is not getting called. Or may b I am using the wrong function.