我正在使用QBSimpleChat SDK。我想发送简单的群发消息。请帮忙。这是我的代码。看看我错过了什么。提前谢谢。
QBChatMessage * inviteMessage = [QBChatMessage message];
NSMutableDictionary *customParams = [NSMutableDictionary new];
//customParams[@"xmpp_room_jid"] = roomJID;
customParams[@"name"] = name;
customParams[@"_id"] = senderId1;
customParams[@"save_to_history"] = @YES;
//customParams[@"type"] = 2;
inviteMessage.senderID = senderId;
inviteMessage.dateSent = [NSDate date];
inviteMessage.senderNick = @"me";
inviteMessage.text = text;
customParams[@"occupants_ids"] = [occupides componentsJoinedByString:@","];
NSString *afterSpace= [occupides componentsJoinedByString:@" "];
NSUInteger num = [oneer integerValue];
NSTimeInterval timestamp = (unsigned long)[[NSDate date] timeIntervalSince1970];
customParams[@"date_sent"] = @(timestamp);
// send notification
//
inviteMessage.recipientID = num;
//}
inviteMessage.customParameters = customParams;
[QBRequest createMessage:inviteMessage successBlock:^(QBResponse *response, QBChatMessage *createdMessage) {
NSLog(@"success: %@", createdMessage);
} errorBlock:^(QBResponse *response) {
NSLog(@"ERROR: %@", response.error);
}];
[self.chatSectionManager addMessage:inviteMessage];
[self finishSendingMessageAnimated:YES];
NSLog(@"message for group is = %@",inviteMessage);
答案 0 :(得分:0)
您可以使用QBChatDialog
实例的方法发送消息:
- (void)sendMessage:(QB_NONNULL QBChatMessage *)message completionBlock:(QB_NULLABLE_S QBChatCompletionBlock)completion;
如需进一步说明,请关注our guide。