SDKsiOSEnterprise
Save a local transcript
Save a transcript in the current device’s message extension field with OpenIM iOS SDK.
Audio message models (OIMSoundElem) do not possess built-in properties for storing transcript text. To persist and display transcribed text for a voice message on the current device, save the transcript payload into the message's local extension field (localEx):
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | NSString * | Yes | Target conversation identifier. |
clientMsgID | NSString * | Yes | Client message ID of the target audio message. |
localEx | NSString * | Yes | Local extension JSON string containing the transcript data. |
onSuccess | OIMSuccessCallback | Yes | Success callback confirming the local record was updated. |
onFailure | OIMFailureCallback | Yes | Failure callback returning error code code and descriptive message msg. |
Code example
NSString *localEx = [self mergeTranscript:transcript intoLocalEx:message.localEx];
[[OIMManager manager] setMessageLocalEx:conversationID
clientMsgID:message.clientMsgID
localEx:localEx
onSuccess:^(NSString * _Nullable data) {
// Local extension saved; refresh message bubble UI
}
onFailure:^(NSInteger code, NSString * _Nullable msg) {
// Handle save failure
}];Return value
The onSuccess callback confirms that the local SQLite database record was updated on the current device.
State changes after the call
- Local-only persistence: Updating
localExmutates only the local database record on the current device. It is not synchronized to remote servers or other client devices, and does not trigger remote message events. The client merge key isclientMsgIDscoped toconversationID. - Namespace safety: Merge the transcript under a distinct key (e.g.
transcript) within existing JSON data rather than overwriting other custom local properties. For general local extension updates, see Set a message’s local extension. For transcription workflows, see Transcribe audio.
Was this page helpful?