Browse SDKs · iOS
Platform
SDKsiOS

Send a message without SDK-managed upload

Send a message that already contains remote resource URLs with OpenIM iOS SDK.

Copy

Invoke sendMessageNotOss:recvID:groupID:isOnlineOnly:offlinePushInfo:onProgress:onSuccess:onFailure: on OIMManager when your application has already uploaded images, audio, video, or files to external storage and built a message using a URL factory method. This dispatches the message directly without triggering SDK-managed upload flows:

Parameters

ParameterTypeRequiredDescription
urlMessageOIMMessageInfo *YesPrepared message object already containing remote resource URLs.
recvIDNSString *ConditionalReceiver user ID for one-to-one chats. Required for single chat; pass nil for group messages.
groupIDNSString *ConditionalTarget group ID for group chats. Required for group chat; pass nil for single messages. recvID and groupID are mutually exclusive.
isOnlineOnlyBOOLYesWhether the message is delivered to online users only. Set to YES to bypass offline storage and push notifications; normally set to NO.
offlinePushInfoOIMOfflinePushInfo *NoCustom offline push configuration including title, description, and pass-through payload. Pass nil for defaults.
onProgressOIMNumberCallbackNoProgress callback. Typically pass nil because resources are already uploaded.
onSuccessvoid (^)(OIMMessageInfo *sent)YesSuccess callback returning the confirmed message model.
onFailureOIMFailureCallbackYesFailure callback returning error code code and descriptive message msg.

Code example

[[OIMManager manager] sendMessageNotOss:urlMessage
                                 recvID:receiverUserID
                                groupID:nil
                           isOnlineOnly:NO
                        offlinePushInfo:nil
                             onProgress:nil
                              onSuccess:^(OIMMessageInfo *sent) {
    // Delivery succeeded; merge confirmed message by clientMsgID
    if (sent != nil) {
        [messageStore upsert:sent];
    }
}
                              onFailure:^(NSInteger code, NSString * _Nullable msg) {
    // Handle message delivery failure
}];

Return value

The onSuccess callback receives the confirmed OIMMessageInfo model returned by the server. The client merge key is clientMsgID (scoped to conversationID when organizing multi-conversation caches).

State changes after the call

  1. Bypassing storage uploads: The SDK performs local record insertion and direct network dispatch without uploading media assets.
  2. Metadata verification: Ensure that the asset URLs, file sizes, MIME types, dimensions, and playback durations inside urlMessage represent valid remote resources.
  3. Incoming message handling: For incoming message event listeners and UI update flows, see Receive messages.