Browse SDKs · iOS
SDKsiOS

Send a message

Send a prepared message object with OpenIM iOS SDK.

Copy
[[OIMManager manager] sendMessage:message
                           recvID:receiverUserID
                          groupID:nil
                     isOnlineOnly:NO
                  offlinePushInfo:nil
                        onSuccess:^(OIMMessageInfo *sent) {
    if (sent != nil) [messageStore upsert:sent];
}
                       onProgress:^(NSInteger progress) {
    [messageStore updateProgress:progress clientMsgID:message.clientMsgID];
}
                        onFailure:nil];

For a one-to-one chat, provide only recvID; for a group chat, provide only groupID. An isOnlineOnly message is not stored in regular offline history. offlinePushInfo optionally configures push notifications. The message passed to the success callback may be nil; when it is present, merge it by clientMsgID. Progress, success, the receiving delegate, and a history query are separate stages.