【问题标题】:how to send simple text message using quickblox sdk?如何使用 quickblox sdk 发送简单的短信?
【发布时间】:2016-04-02 12:53:17
【问题描述】:

我正在使用 QBSimpleChat SDK。我想发送简单的群消息。请帮忙。这是我的代码。看看我错过了什么。提前致谢。

QBChatMessage *inviteMessage = [QBChatMessage 消息];

        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);

【问题讨论】:

    标签: sdk quickblox


    【解决方案1】:

    您可以使用QBChatDialog实例的方法发送消息:

    - (void)sendMessage:(QB_NONNULL QBChatMessage *)message completionBlock:(QB_NULLABLE_S QBChatCompletionBlock)completion;
    

    更多解释请关注our guide

    【讨论】:

      猜你喜欢
      • 2016-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-26
      • 2011-02-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多