SDKsiOS
Create a file message from a local path
Create a file message from an absolute path with OpenIM iOS SDK.
Invoke createFileMessageFromFullPath:fileName: on OIMMessageInfo to construct a file message from an absolute file path in the local application sandbox. The SDK automatically uploads the file to object storage during message dispatch:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
filePath | NSString * | Yes | Absolute path to the file within the application sandbox. |
fileName | NSString * | Yes | File display name shown in conversation message bubbles. |
Code example
OIMMessageInfo *message =
[OIMMessageInfo createFileMessageFromFullPath:fileURL.path
fileName:fileURL.lastPathComponent];Return value
Returns an initialized OIMMessageInfo model with its content type set to file.
State changes after the call
- Local memory instantiation: This method builds an in-memory message model without persisting records to local storage or initiating network uploads immediately.
- Subsequent dispatch: Call Send a message to execute file upload and deliver the message. If the file is already uploaded to remote storage, use Create a file message from a URL.
Was this page helpful?