如何使用 quickblox sdk 发送简单的短信?

Posted

技术标签:

【中文标题】如何使用 quickblox sdk 发送简单的短信?【英文标题】:how to send simple text message using 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);

【问题讨论】:

【参考方案1】:

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

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

更多解释请关注our guide。

【讨论】:

以上是关于如何使用 quickblox sdk 发送简单的短信?的主要内容,如果未能解决你的问题,请参考以下文章

Quickblox:即使发送消息,iOS sdk 也会在发送时返回错误

无法使用 QuickBlox Javascript SDK 发送聊天消息

使用 Quickblox SDK 2.17 将视频作为附件发送

使用 quickblox 和 IOS sdk 实现预定的推送通知

QuickBlox iOS SDK 更新消息

在集成 Quickblox SDK 时限制发送状态的数量